[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
Wed Jun 12 03:51:16 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>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/95220 at github.com>


carlosgalvezp wrote:

> Rename the analysis from AvoidBoundsErrorsCheck to PreferAtOverSubscriptOperatorCheck as requested by @PiotrZSL 

I'm strongly opposed to this, because it's conflating "how to solve the problem" with "what the problem is".

If we want to focus on the problem, the check could be named "AvoidSubscriptOperator". This way, the solution to the problem is open for users to decide.

> discussed the possibility of disabling the check when exceptions are disabled, 

I don't think this is a good idea, as it introduces a dependency towards Clang compiler. And it's a lot more complicated than what I'm proposing.

I would appreciate more elaboration as to why this check *must* use at() and cannot be made optional. 

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


More information about the cfe-commits mailing list