fix(tool,clang): fail generation when libclang reports a fatal parse diagnostic
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 70/100
調査の方向性
Start by reading clang/clang.go:Index.ParseTranslationUnit and tool/gen.go:ParseSources, then reproduce with GOOS=darwin GOARCH=arm64 llcppg ./generated ./source using the issue's missing-header setup. Add or update a regression test around fatal libclang diagnostics so generation exits nonzero, preserves the original diagnostic, and does not continue with the recovered AST. The existing source files and minimal reproduction provide clear starting points, but contributors will need familiarity with the generation pipeline.
索引モデルが issue の本文から書いたものです。
説明
A missing required include produces a libclang fatal diagnostic, but llcppg still returns success. Checking only the translation-unit API's return code does not establish that its recovered AST is valid for generation.
Minimal reproduction
missing.h:
#include "dependency_missing_for_this_reproducer.h"
Do not create that dependency.
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": [
"missing.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
Actual result
missing.h:1:10: fatal error: 'dependency_missing_for_this_reproducer.h' file not found
Despite this diagnostic, the llcppg command exits 0. In the broader libc run, fatal include errors were likewise followed by later generation and an unrelated enum/name panic.
clang/clang.go:Index.ParseTranslationUnit only checks clang_parseTranslationUnit2's error code. tool/gen.go:ParseSources then accepts the returned unit without inspecting its Error/Fatal diagnostics. libclang can return a recoverable translation unit even when its diagnostics include fatal errors.
Expected behavior
Normal generation must fail clearly on a fatal parse diagnostic and must not report a recovered, incomplete AST as a successful conversion. Preserve the original diagnostic rather than allowing later errors to obscure it. No new CLI option or public API is proposed.
This is separate from intentional skipping of an unsupported C type and from #997's context-dependent header discovery: the reproducer uses one explicitly selected input with one missing include.
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時間
- マージ済み PR(30日)
- 150
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
goplus/llcppg のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
goplus/llcppg#1136 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
goplus/llcppg#1133 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
date_time, url_encode, html_escape, to_unix_time, contains_all and contains_any panic when called without arguments対応中かも @antcybersec が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
projectdiscovery/dsl#372 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
JuliusBrussee/caveman#1449 ·
メンテナーはふだん 1 日以内に返信
-
bot-found bug priority: P3
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
madenvel/KalinkaPlayer#498 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
clawsweeper:fix-shape-clear clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
openclaw/gogcli#1291 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信