[clang] [NFC][analyzer] Multipart checker refactor 2: NullabilityChecker (PR #132250)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 20 10:51:35 PDT 2025


================
@@ -491,7 +503,7 @@ void NullabilityChecker::reportBugIfInvariantHolds(
     N = C.addTransition(OriginalState, N);
   }
 
-  reportBug(Msg, Error, CK, N, Region, C.getBugReporter(), ValueExpr);
+  reportBug(Msg, Error, Idx, N, Region, C.getBugReporter(), ValueExpr);
----------------
NagyDonat wrote:

> This feels like a technical difficulty. You could create a `bug(checker)` member fn that gives you the right BugType.

The repeated code fragment is already very short: using bug types instead of indices means that I need to write `BugTypes[LongAndConvolutedNameChecker]` instead of plain `LongAndConvolutedNameChecker`. Introducing a method as you suggested wouldn't be a significant improvement `bug(LongAndConvolutedNameChecker)` is approximately the same as the array indexing.

Overall, I'm very close to indifferent in this question -- the stakes are negligible.

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


More information about the cfe-commits mailing list