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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to