================
@@ -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;
----------------
benedekaibas wrote:
> 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.
I think it is a good idea. For future PRs (related to the explicit object
parameter modeling) I do not think I would use the suggested function, but I
think it is cleaner to have its own method in `CallEvent`. The current
conversion methods (at least the ones I have worked with) have their own
function in `CallEvent`, so I think this would "deserve" it too. Also reading
the `setBitsAccordingToFunctionAttributes` function would be cleaner for
someone I guess.
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