================
@@ -577,14 +577,13 @@ ProgramStateRef 
CallAndMessageChecker::checkArgInitializedness(
 
   const BugType &BT = isa<ObjCMethodCall>(Call) ? MsgArgBug : CallArgBug;
 
-  const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
+  ArrayRef<ParmVarDecl *> Params = Call.parameters();
   for (unsigned i = 0, e = Call.getNumArgs(); i != e; ++i) {
-    const ParmVarDecl *ParamDecl = nullptr;
-    if (FD && i < FD->getNumParams())
-      ParamDecl = FD->getParamDecl(i);
+    // For variadic functions a corresponding parameter decl might not exist.
+    const ParmVarDecl *PVD = i < Params.size() ? Params[i] : nullptr;
----------------
benedekaibas wrote:

I totally agree with your suggestion. I think this change does require the 
comment blocks to be at the most visible place for others. The main place where 
I looked for the indexing kinds is `CallEvent`, so I would put it there and 
with the explanation you have described it would be clear for everyone reading. 

To work with index kinds, someone *has to* visit `CallEvent`. Therefore, 
placing it there would make the most sense for me.

https://github.com/llvm/llvm-project/pull/221977
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to