feat(cl): support Clang ext_vector_type declarations from C headers

オープン
#1,136 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c, go
領域
compilers, tooling

調査の方向性

Start with cl/type.go:toTypeEx and the CXType_ExtVector conversion path, then run the supplied llcppg reproducer with source/llcppg.cfg and simd_float4.h. Done means native extended-vector types and dependent declarations are retained with the target’s required layout and calling convention, with unsupported declarations still clearly identified.

索引モデルが issue の本文から書いたものです。

説明

The libc/LibSystem header survey cannot retain Clang extended-vector types and their dependent matrix/function declarations. The smallest observed case is the SDK's simd_float4 typedef.

Reproducer

simd_float4.h, copied from the SDK declaration:

typedef __attribute__((__ext_vector_type__(4))) float simd_float4;

Use a source Go module requiring github.com/goplus/lib v0.7.0, with this configuration in source/llcppg.cfg:

{
  "Name": "libc",
  "Language": "c",
  "Dir": "$GOOS-$GOARCH/include",
  "Files": [
    "simd_float4.h"
  ],
  "FailFast": 0,
  "IgnoreInline": true
}

Put the selected inputs under source/darwin-arm64/include, with the macOS 14.0 SDK headers available there where included. Leave Stdlib unset, and run:

GOOS=darwin GOARCH=arm64 llcppg ./generated ./source

Current result

Generation exits 0 but omits the type:

-: toType: unsupported type -  (176: float __attribute__((ext_vector_type(4))))

176 is CXType_ExtVector. cl/type.go:toTypeEx has no conversion case for it. Parsing simd/math.h and simd/matrix.h produces many dependent skipped typedefs, records, variables and overloaded functions.

Requested support

Retain native extended-vector types and their dependent declarations with the target's required layout and calling convention. A same-size Go array alone is not sufficient evidence of vector ABI compatibility. The representation and any compiler requirements need to be established before selecting a mapping; this issue does not prescribe a new public helper API or fallback wrapper.

#1033 explicitly covers atomic/complex/128-bit/floating types and unprototyped function pointers, but does not include Clang extended vectors. Existing unsupported declarations should remain visibly identified until this support is implemented.

Environment

Reproduced on macOS/arm64 with LLVM/libclang 22.1.8, LLGo 1.0.9 and github.com/goplus/lib v0.7.0. The relevant installed generator sources were checked byte-for-byte against current main 90bd72cf. SDK-dependent cases use macOS 14.0 headers. These are generation-stage results, not cross-platform or ABI certification.

主要言語
Go
スター
40
フォーク
13
平均マージ
2時間 9分
マージ済み PR(30日)
135

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

goplus/llcppg のほかの issue

goplus/llcppg の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。