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

Benedek Kaibas via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 15 02:39:34 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;
+      if (IdxArg >= AttrNonNull.size())
         continue;
-      AttrNonNull.set(IdxAST);
+      AttrNonNull.set(IdxArg);
     }
   }
 }
 
 template <class CallType>
 void setBitsAccordingToParameterAttributes(const CallType &Call,
                                            llvm::SmallBitVector &AttrNonNull) {
+  unsigned ArgIdx = 0;
----------------
benedekaibas wrote:

Good catch, thank you! And yes you are right that this is the native index kind of `CallEvent`, so it should be named consistently.

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


More information about the llvm-branch-commits mailing list