[PATCH] D41266: [analyzer] With c++-allocator-inlining, fix memory space for operator new pointers.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 14 17:17:04 PST 2017


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet.
Herald added subscribers: cfe-commits, rnkovacs.

Default global `operator new()`, like `malloc()`, should return heap pointers, which in the analyzer are represented by `SymbolicRegion`s with `HeapSpaceRegion` as their parent.

In the `-analyzer-config c++-allocator-inlining` mode, this was broken, and regular `SymbolicRegion`s were returned instead,  which have `UnknownSpaceRegion` as their parent.

This patch fixes this straightforwardly on `ExprEngine` side. We may want to delegate this job to the checkers though `evalCall`, but for now this mode doesn't support `evalCall` for `operator new()`, and i'm not sure if it'd be used much.

With this patch going on top of previous patches, enabling `c++-allocator-inlining` by default causes no regressions on tests (causes some improvements though). It doesn't mean it works (we still have callbacks broken, path diagnostic pieces unsupported, and i've just noticed one more void element region crash), just a psychological checkpoint.


Repository:
  rC Clang

https://reviews.llvm.org/D41266

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  test/Analysis/NewDelete-checker-test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41266.127052.patch
Type: text/x-patch
Size: 4719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171215/8cc2703e/attachment.bin>


More information about the cfe-commits mailing list