This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Handle NTTP invocation in CallContext.getCalleeDecl()
ClosedPublic

Authored by tomasz-kaminski-sonarsource on May 24 2021, 7:04 AM.

Details

Summary

This fixes a crash in MallocChecker for the situation when operator new (delete) is invoked via NTTP and makes the behavior of CallContext.getCalleeDecl(Expr) identical to CallEvent.getDecl().

Diff Detail

Event Timeline

tomasz-kaminski-sonarsource requested review of this revision.May 24 2021, 7:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2021, 7:04 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

The alternative solution, that I think may be preferable is to remove following functions from CheckerContext and use CallEvent.getDecl() instead:

const FunctionDecl *getCalleeDecl(const CallExpr *CE) const;
const IdentifierInfo *getCalleeIdentifier(const CallExpr *CE) const;
StringRef getCalleeName(const CallExpr *CE) const;
vsavchenko accepted this revision.Jun 18 2021, 2:15 AM

Looks good to me!
Sorry it took forever!

This revision is now accepted and ready to land.Jun 18 2021, 2:15 AM

Would it be possible to merge it for me, as I do not have a commit right?

Would it be possible to merge it for me, as I do not have a commit right?

Sure thing!
Which email should I set for commit author?

For the author information use:
Tomasz Kamiński
tomasz.kaminski@sonarsource.com

Thanks for fixing this!