[PATCH] D41250: [analyzer] Model implied cast around operator new().

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 15 16:21:32 PST 2017


NoQ updated this revision to Diff 127202.
NoQ added a comment.

`VisitCXXNewExpr` is too late. We need to perform cast before calling the constructor. Otherwise bad things happen, for instance `performTrivialCopy` would construct another void region :)

Move the cast to `pushCXXNewAllocatorValue()`. This way we perform the cast before putting this-value into our temporary storage (the top of `CXXNewAllocatorValueStack`, or `_this` in terms of http://lists.llvm.org/pipermail/cfe-dev/2017-December/056314.html), which seems correct. And this affects all two code paths on which we exit the allocator call - both the `conservativeEvalCall` path and the `processCallExit` path (and ideally the future `evalCall` path).


https://reviews.llvm.org/D41250

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  lib/StaticAnalyzer/Core/Store.cpp
  test/Analysis/new-ctor-conservative.cpp
  test/Analysis/new-ctor-inlined.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41250.127202.patch
Type: text/x-patch
Size: 5414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171216/d79d85ca/attachment.bin>


More information about the cfe-commits mailing list