]> granicus.if.org Git - clang/commit
[analyzer] Add a CFG node for the allocator call in a C++ 'new' expression.
authorJordan Rose <jordan_rose@apple.com>
Mon, 13 Jan 2014 17:59:19 +0000 (17:59 +0000)
committerJordan Rose <jordan_rose@apple.com>
Mon, 13 Jan 2014 17:59:19 +0000 (17:59 +0000)
commit787819c99a813f1fd2f203b4fc7aa975fa645c54
treea442feca1338651722f380c17c2896dbe0ec46c7
parent110038065b525ebadb0b1c7a757baf74cb7d0b84
[analyzer] Add a CFG node for the allocator call in a C++ 'new' expression.

In an expression like "new (a, b) Foo(x, y)", two things happen:
- Memory is allocated by calling a function named 'operator new'.
- The memory is initialized using the constructor for 'Foo'.

Currently the analyzer only models the second event, though it has special
cases for both the default and placement forms of operator new. This patch
is the first step towards properly modeling both events: it changes the CFG
so that the above expression now generates the following elements.

1. a
2. b
3. (CFGNewAllocator)
4. x
5. y
6. Foo::Foo

The analyzer currently ignores the CFGNewAllocator element, but the next
step is to treat that as a call like any other.

The CFGNewAllocator element is not added to the CFG for analysis-based
warnings, since none of them take advantage of it yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199123 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Analysis/AnalysisContext.h
include/clang/Analysis/CFG.h
include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
lib/Analysis/AnalysisDeclContext.cpp
lib/Analysis/CFG.cpp
lib/Sema/AnalysisBasedWarnings.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/PathDiagnostic.cpp
test/Analysis/cfg.cpp