[PATCH] D49656: [analyzer] Add support for more pointer invalidating functions in InnerPointerChecker

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 23 17:31:56 PDT 2018


NoQ added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2934
+            } else if (const auto *CallE = dyn_cast<CallExpr>(S)) {
+              OS << CallE->getDirectCallee()->getNameAsString();
             }
----------------
rnkovacs wrote:
> xazax.hun wrote:
> > I think `getDirectCallee` might fail and return `nullptr`. One more reason to test function pointers :)
> You're right. Also, it needed a bit more effort to dig up the function pointer's name. Or should I go further and somehow find out the name of the function it points to?
> Also, it needed a bit more effort to dig up the function pointer's name.

I think it should work out of the box; `Call.getDecl()` is smart enough to show the right decl when a pointer to a concrete function is being called on the current path.


https://reviews.llvm.org/D49656





More information about the cfe-commits mailing list