Szelethus marked 4 inline comments as done.
Szelethus added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:614
+  static ProgramStateRef CallocMem(CheckerContext &C, const CallEvent &Call,
                                    ProgramStateRef State);
 
----------------
NoQ wrote:
> Is the state parameter still necessary here?
Not as per its current usages in the code, but it does make sense, if we do 
some prechecks and modify the state before calling this functions.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1194
-  if (!FD)
+  if (!Call.getOriginExpr())
     return;
 
----------------
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? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75432



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

Reply via email to