microsoft / microsoft/vscode-cpptools
clang-tidy fix for cppcoreguidelines-pro-bounds-constant-array-index generates invalid code
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 6.2k
- フォーク
- 1.7k
- 平均マージ
- 14時間 46分
- マージ済み PR(30日)
- 61
説明
With 1.10.1 (currently unreleased), using "C_Cpp.codeAnalysis.clangTidy.config": "{ Checks: 'cppcoreguidelines-pro-bounds-constant-array-index', CheckOptions: [{key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader, value: '<gsl/gsl.h>'}]}"
with code
#include <array>
int func(int i)
{
std::array<int, 2> vvv;
return vvv[i];
}
generates the incorrect code return gsl::at(v, i);.
It's already reported at https://github.com/llvm/llvm-project/issues/37858 .
Bug#2: There's another related bug at https://github.com/llvm/llvm-project/issues/55088 , when there's an #if/endif at the top of the file.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue にある clang-tidy の設定と C++ の例を再現し、生成された fix を LLVM の issue 37858 および 55088 と比較します。vscode-cpptools のコード解析の fix パスを追跡します。完了の条件は、報告された配列インデックスのケースで無効なコードが生成されなくなることです。先頭に #if/endif があるバリアントも含みます。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100