[PATCH] Model Constructor corresponding to a new call

Karthik Bhat kv.bhat at samsung.com
Fri Jan 24 06:13:24 PST 2014


Hi jordan_rose,

Hi Jordan,
This patch is not yet complete and I'm not completly sure about this patch yet, as in if this is the correct way to model allocator call.
I would like to get a few inputs if i'm in the right direction.

Since we have modelled Allocator in CFG i'm now trying to plugin in the same into SA Core. 
I'm a bit confused on what part of VisitCXXNewExpr will go into VisitCXXNewAllocatorCall and if that is required?

In this patch i have just called the relevent allocator function in VisitCXXNewAllocatorCall and  proceeded. 
In VisitCXXConstructExpr i check if this constructor was call due to a call to new in which case i use the CXXNewExpr to conjure a symbol and use the memregion returned to call the constructor. 
Later when VisitCXXNewExpr the same region is returned for the CXXNewExpr and i continue with other initialization.

This seem to work and constructor is now getting inlined and relevent warnings are now being detected but i'm not sure if this approach is correct.

Could you guide me if we can follow this approach? If not how exactly to model VisitCXXNewAllocatorCall call to reuse the allocated memregion in VisitCXXConstructExpr?

Any inputs would be greatly appreciated.

Thanks
Karthik Bhat

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

Files:
  test/Analysis/new.cpp
  test/Analysis/inline.cpp
  test/Analysis/temporaries.cpp
  test/Analysis/ctor.mm
  lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2616.1.patch
Type: text/x-patch
Size: 12215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140124/7c4ccb4d/attachment.bin>


More information about the cfe-commits mailing list