[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 16 00:41:02 PDT 2024


Paul =?utf-8?q?Heidekrüger?= <paul.heidekrueger at tum.de>,
Paul =?utf-8?q?Heidekrüger?= <paul.heidekrueger at tum.de>,
Paul =?utf-8?q?Heidekrüger?= <paul.heidekrueger at tum.de>,
Paul =?utf-8?q?Heidekrüger?= <paul.heidekrueger at tum.de>,
Paul =?utf-8?q?Heidekrüger?= <paul.heidekrueger at tum.de>,
Paul =?utf-8?q?Heidekrüger?= <paul.heidekrueger at tum.de>,
Paul =?utf-8?q?Heidekrüger?= <paul.heidekrueger at tum.de>,
Paul =?utf-8?q?Heidekrüger?= <paul.heidekrueger at tum.de>,
Paul =?utf-8?q?Heidekrüger?= <paul.heidekrueger at tum.de>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/95220 at github.com>


carlosgalvezp wrote:

> I specifically added container to both names because the check is in SL.con

Sounds good to me! My main goal is not constraining the check to only `operator[]`; in the future someone might want to also implement functionality to detect e.g. `std::memset` as you mentioned, and in that case it would be awkward to create a new check even though it covers the same rule.

Btw, I realize that this check is part of the [bounds profile](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-bounds) (Bounds.4), so for consistency it should probably be named `cppcoreguidelines-pro-bounds-...`. This becomes then the last remaining check to complete the bounds profile!

https://github.com/llvm/llvm-project/pull/95220


More information about the cfe-commits mailing list