[PATCH] [StaticAnalyzer]Handle Destructor call generated by C++ delete expr

Karthik Bhat kv.bhat at samsung.com
Thu Sep 12 21:58:45 PDT 2013


  Hi Jordan,
  Thanks for the review and sorry for keeping this simple patch on hold for such a long time. I'm a bit new to SA Core and was bit confused about the UnknownVal thing. I think i understand now what you wanted to communicate.
  So if my understanding is correct this is what we want to do-

  Memory region can be null here in 2 cases here-
  1) When it is actually bound to a null value.
  2) In case the SVal is Unknown and we try to get the region corresponding to it.

  In the 1st case we can conclude that this is a null region and hence should not run the destructor but in the second case we cannot be sure if it is actually bound to a null region and hence should run destructor in this case.
  Am i right here?

  Handled the same in ProcessDeleteDtor. What we are doing here is if we can conclude that the SVal is null don't run the destructor.
  For all other cases call VisitCXXDestructor so it is handled in the same way as it is currently being done for object destruction.

  Also added a fixme in malloc checker and modified test cases to follow llvm coding guidelines.

  Thanks!

Hi jordan_rose,

http://llvm-reviews.chandlerc.com/D1594

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1594?vs=4222&id=4261#toc

Files:
  test/Analysis/new.cpp
  include/clang/Analysis/CFG.h
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  lib/StaticAnalyzer/Core/CallEvent.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1594.5.patch
Type: text/x-patch
Size: 6356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130912/ba148679/attachment.bin>


More information about the cfe-commits mailing list