microsoft / microsoft/vscode-cpptools
C_Cpp.codeAnalysis.clangTidy.useBuildPath should work with CMake configuration
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 6.2k
- フォーク
- 1.7k
- 平均マージ
- 14時間 46分
- マージ済み PR(30日)
- 61
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
C_Cpp.codeAnalysis.clangTidy.useBuildPath と C_Cpp.default.compileCommands の処理を確認し、CMake 構成プロバイダーとその生成された compile_commands.json で問題を再現してください。cmake.copyCompileCommands と ${command:cmake.buildDirectory} がどのように処理されるかを確認し、固定されたコピー先パスを必要とせずに useBuildPath が機能することを検証してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cmake, cpp, vscode
- 領域
- build-system, developer-experience, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100