microsoft / microsoft/vscode-cpptools
C_Cpp.codeAnalysis.clangTidy.useBuildPath should work with CMake configuration
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
I use ms-vscode.cmake-tools and ms-vscode.cpptools and rely on the default behaviour as much as possible.
When running Code analysis on active file clang-tidy crashes. I can also call clang-tidy (even official clang-tidy-14) with all the arguments that the cpptools would pass and get a crash. It really looks like a clang-tidy bug. I tried to work around by passing compile_commands.json to clang-tidy.
Not sure how C_Cpp.codeAnalysis.clangTidy.useBuildPath is supposed to work.
Just having
"C_Cpp.codeAnalysis.clangTidy.useBuildPath": true
does not pass the -p option, it still passes build arguments after --. It seems I also have to set "C_Cpp.default.compileCommands".
"C_Cpp.default.compileCommands": "${command:cmake.buildDirectory}/compile_commands.json"
also does not work. It looks like C_Cpp.default.compileCommands does not support any substitutions, even ${workspaceFolder} does not work.
The only way I could make it work was something like
"cmake.copyCompileCommands": "/workspace/build/compile_commands.json",
"C_Cpp.default.compileCommands": "/workspace/build/compile_commands.json",
"C_Cpp.codeAnalysis.clangTidy.useBuildPath": true
With the first cmake.copyCompileCommands I copy the current configuration (I have multiple) to a stable location. This can be used by C_Cpp.default.compileCommands and the -p=/workspace/build/ is passed to clang-tidy.
Substitutions should be supported by C_Cpp.default.compileCommands.
Only setting C_Cpp.codeAnalysis.clangTidy.useBuildPath to true should be enough if ms-vscode.cmake-tools is the configuration provider and it has generated a compile_commands.json
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Esaminare la gestione di C_Cpp.codeAnalysis.clangTidy.useBuildPath e C_Cpp.default.compileCommands, quindi riprodurre il problema con il provider di configurazione CMake e il compile_commands.json da esso generato. Verificare come vengono gestiti cmake.copyCompileCommands e ${command:cmake.buildDirectory}, e verificare che useBuildPath funzioni senza richiedere un percorso copiato fisso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cmake, cpp, vscode
- Ambito
- build-system, developer-experience, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100