microsoft / microsoft/vscode-cpptools
Code Analysis with useBuildPath=true gives 'stddef.h' file not found unless clangTidy.path is changed
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
If C_Cpp.codeAnalysis.clangTidy.useBuildPath is true then 'stddef.h' file not found may occur with the clang-tidy version that ships with our extension. The workaround is to set C_Cpp.codeAnalysis.clangTidy.path or possibly to launch VS Code with certain environment variables set (that works on Windows with the VS developer command prompt, but I'm not sure if there's a Linux/Mac equivalent). The problem is there is a particular clang system header include path that isn't being used. I don't know if there's a way to fix this via potentially some change to how we're building the clang-tidy binary or if we could manually locate/add the missing system include path header. I recall the missing path is something like /usr/lib/llvm-10/lib/clang/10.0.0/include -- when clang 10 is installed on the machine...it's possibly related to the fact that we build clang 14 and it's possible the issue may not repro if the matching version of the /usr/lib/llvm- is installed.
A user report is at https://github.com/microsoft/vscode-cpptools/issues/9555, but it got morphed into a bug on relative paths.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing with C_Cpp.codeAnalysis.clangTidy.useBuildPath=true and the clang-tidy version shipped with the extension, then compare its system include paths with the path used by a matching installed LLVM version. Done means clang-tidy can find stddef.h without changing clangTidy.path or relying on a platform-specific developer environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100