================
@@ -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;
----------------
NagyDonat wrote:
Why is this an `ArgIdx` when it is incremented in a loop that iterates over
`Call.parameters()`??
I feel that the old `ParameterIdx` is more natural – and if this is the
"native" indexing kind of `CallEvent` and can index both arguments and
parameters (this is my guess but I'm not sure), then choose a name like
`ImplIdx` or `NativeIdx` that does not refer to either `Arg` or `Param`. (And
consistently use the same name for all variables that hold this kind of index.)
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