================
@@ -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;
----------------
NagyDonat wrote:
Do I understand it here that you're indexing `Call.parameters()` with a
`CallEvent`-specific index (`CallArgIdx`)? Is it the correct index to use here
(e.g. instead of `DeclParamIdx`, which is a _parameter_ index)?
If the "native" `CallEvent`-specific index is used for both
`Call.parameters()` and the arguments of the call, then try to replace
`CallArgIdx` etc. with a name like `ImplIdx` or `NativeIdx` that does not
contain either `Arg` or `Param`.
Also it would be nice to have a comment block that describes that there are
three indexing conventions, explains their customary names (which should be
used very consistently!) and for each of them lists the places where it should
be used.
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