[llvm-branch-commits] [clang] [analyzer][NFC] Index parameter lookups by argument position (PR #221977)

Donát Nagy via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 15 03:03:52 PDT 2026


================
@@ -63,23 +80,27 @@ void setBitsAccordingToFunctionAttributes(const CallType &Call,
       // 'nonnull' attribute's parameters are 1-based and should be adjusted to
       // match actual AST parameter/argument indices.
       unsigned IdxAST = Idx.getASTIndex();
-      if (IdxAST >= AttrNonNull.size())
+      if (IdxAST < Offset)
+        continue;
+      const unsigned IdxArg = IdxAST - Offset;
----------------
NagyDonat wrote:

I see.

Then what would you think about _introducing_ a conversion method `adjustASTArgIdxToNativeIdx` within `class CallEvent`? Perhaps it's an overkill, but perhaps other checkers may also need this logic – and the logic itself may also change if the next versions of C++ introduce yet another exceptional parameter kind.

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


More information about the llvm-branch-commits mailing list