[PATCH] D75432: [analyzer][NFC][MallocChecker] Convert many parameters into CallEvent

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 20 09:16:11 PDT 2020


Szelethus marked an inline comment as done.
Szelethus added a comment.

This will take a while for me to fix (couple hours, wanna wait for creduce to finish running, and I needed to compile llvm on the server as well), but I'll get it done probably today.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1194
-  if (!FD)
+  if (!Call.getOriginExpr())
     return;
 
----------------
balazske wrote:
> Szelethus wrote:
> > Szelethus wrote:
> > > balazske wrote:
> > > > Szelethus wrote:
> > > > > Szelethus wrote:
> > > > > > balazske wrote:
> > > > > > > This should be added to avoid later crash (probably not needed for every check kind?):
> > > > > > > ```
> > > > > > >   const FunctionDecl *FD = C.getCalleeDecl(CE);
> > > > > > >   if (!FD)
> > > > > > >     return;
> > > > > > > ```
> > > > > > Not all `CallEvent`s have a corresponding `FunctionDecl` or a `CallExpr`, for instance, `CXXAllocatorCall` corresponds with `CXXNewExpr`, which is not a `CallExpr`, but it is handled by this checker. For this reason, I decided to move this check to the individual modeling functions.
> > > > > Oh I'm sorry, do we have an actual crash resulting from this? 
> > > > I did not look into it by detail but the problem is in `MallocChecker::checkOwnershipAttr` with a null `FD`. Probably it is enough to insert a return at that point (makes the crash gone on that analyzed project).
> > > I'm sorry but I don't have enough to follow up on this. On the master branch, everything seems to work smoothly for me (all tests pass) and I didn't get any buildbot failures. Can you post a code snippet?
> > If you have a project name, I can analyze that myself to save you the trouble.
> Could not debug the problem because debug info was not there for unknown reason (no exact line locations were printed). But the project was emacs 26.3 `configure --with-xpm=no --with-gif=no --with-tiff=no --with-gnutls=no`, failed at one of the the first files with CodeChecker analyze.
No worries, I'll attend to it myself. Thank you for the quick response though!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75432/new/

https://reviews.llvm.org/D75432





More information about the cfe-commits mailing list