microsoft / microsoft/vscode-cpptools
C_Cpp.codeAnalysis.clangTidy.useBuildPath should work with CMake configuration
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 61
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Lea el manejo de C_Cpp.codeAnalysis.clangTidy.useBuildPath y C_Cpp.default.compileCommands, y luego reproduzca el problema con el proveedor de configuración de CMake y su compile_commands.json generado. Compruebe cómo se gestionan cmake.copyCompileCommands y ${command:cmake.buildDirectory}, y verifique que useBuildPath funcione sin requerir una ruta copiada fija.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cmake, cpp, vscode
- Área
- build-system, developer-experience, tooling
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100