clang-tidy fails on standalone headers with GCC cross-compiler predefines, but succeeds with compilation database
維護者通常 1 天內回覆
@Colengms 已經在處理了。
開始於 2026年10月13日。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- cmake, cpp, typescript, vscode
- 領域
- build-system, devtools
研究方向
Start with the attached clang-tidy_log.txt and compare the synthesized header command against compile_commands.json for the including .cpp file. Reproduce the C++23 CMake project case, then verify that header analysis succeeds without the reported GCC predefined-macro errors while still producing ordinary header diagnostics.
由索引模型根據 Issue 內容生成。
描述
Environment
Environment
VS Code 1.140.0, Ubuntu 22.04.5
C/C++ extension 1.34.4; bundled clang-tidy 23.1.0
CMake Tools 1.24.42; GCC 13.4.0 cross-compiler and its SDK libstdc++ headers
C++23 CMake project; CMAKE_EXPORT_COMPILE_COMMANDS=ON
C_Cpp.codeAnalysis.clangTidy.enabled=true and useBuildPath=true
c_cpp_properties.json sets compileCommands and uses the CMake Tools configuration provider
Bug Summary and Steps to Reproduce
Reproduction
- Configure a C++23 CMake target containing a .cpp that includes a project .h. The header includes SDK C++ headers such as .
- Confirm compile_commands.json has an entry for the .cpp, but none for the .h.
- Open or save the header with automatic clang-tidy analysis enabled.
- Compare this with analyzing the .cpp, or running bundled clang-tidy with -p .
Actual behavior
The extension analyzes the header using synthesized arguments after --, rather than -p. The logged command includes -std=gnu++23, SDK include paths, and hundreds of GCC predefined macros passed as -D__.... Clang-tidy reports errors in SDK libstdc++ headers involving _Float32, _Float64, and bf16, followed by too many errors emitted and Error while processing
Replaying the logged header command fails. Replaying that same command with only GCC -D__.../-U__... arguments removed succeeds and still produces ordinary header diagnostics. Direct clang-tidy -p
also succeeds.Expected behavior
Header analysis should use a compatible command associated with the including translation unit, or avoid passing GCC-only predefined macros as explicit arguments to Clang.
Impact
The processing error appears on headers after opening or saving them, despite successful project builds, and makes header diagnostics unreliable.
Configuration and Logs
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++23",
"intelliSenseMode": "gcc-x64",
"compileCommands": "${workspaceFolder}/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
Other Extensions
No response
Additional context
No response
- 主要語言
- TypeScript
- 星號
- 6.2k
- 分支
- 1.7k
- 平均合併
- 1 天 16 小時
- 30 天內合併 PR
- 20
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/vscode-cpptools 的其他 Issue
-
Allow case-insensitive suppression of parameter inlay hints可能已有人在做 @Colengms 於 9 天前認領。 未關閉bug Feature: Inlay Hint fixed Language Service
難度 2/5 1-3 小時 新手友好度 68/100
microsoft/vscode-cpptools#14829 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Language server exits with code 0 and restarts repeatedly (1.35.4, Windows 11)可能已有人在做 @sean-mcmanus 今天認領。 未關閉bug Language Service more info needed reliability
microsoft/vscode-cpptools#14841 · 4 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
code runner未關閉Language Service more info needed
難度 5/5 一週以上 新手友好度 15/100
microsoft/vscode-cpptools#14840 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 4/5 1-2 天 新手友好度 46/100
microsoft/vscode-cpptools#14839 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 30/100
microsoft/vscode-cpptools#14838 ·
維護者通常 1 天內回覆
查看 microsoft/vscode-cpptools 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
Automattic/data-liberation-agent#953 ·
維護者通常 1 天內回覆
-
documentation
難度 1/5 1 小時以內 新手友好度 90/100
funmary-app/funmary#399 ·
維護者通常 1 天內回覆
-
area:curator enhancement
難度 2/5 1-3 小時 新手友好度 74/100
CassioDalla/Scrinalia#150 ·
維護者通常 1 天內回覆
-
status: needs-triage v1-bug-bash
難度 2/5 1-3 小時 新手友好度 82/100
a2ui-project/a2ui#3533 ·
維護者通常 1 天內回覆
-
backend enhancement priority:P3
難度 2/5 1-3 小時 新手友好度 78/100
geolens-io/geolens#3310 ·
維護者通常 1 天內回覆