diff options
| author | Jordan Rose <jordan_rose@apple.com> | 2013-03-30 01:31:42 +0000 |
|---|---|---|
| committer | Jordan Rose <jordan_rose@apple.com> | 2013-03-30 01:31:42 +0000 |
| commit | 8f6b4b043aff942f66995e401221e62dfe3d7fd9 (patch) | |
| tree | d67a6b72bae651ee01747049535d70aedf1e349f /clang/test/Analysis/new.cpp | |
| parent | 6fdef11c1703e7565144c556e31ba7994d735d01 (diff) | |
| download | bcm5719-llvm-8f6b4b043aff942f66995e401221e62dfe3d7fd9.tar.gz bcm5719-llvm-8f6b4b043aff942f66995e401221e62dfe3d7fd9.zip | |
[analyzer] Handle caching out while evaluating a C++ new expression.
Evaluating a C++ new expression now includes generating an intermediate
ExplodedNode, and this node could very well represent a previously-
reachable state in the ExplodedGraph. If so, we can short-circuit the
rest of the evaluation.
Caught by the assertion a few lines later.
<rdar://problem/13510065>
llvm-svn: 178401
Diffstat (limited to 'clang/test/Analysis/new.cpp')
| -rw-r--r-- | clang/test/Analysis/new.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Analysis/new.cpp b/clang/test/Analysis/new.cpp index 004a05ef94f..44ae9802f81 100644 --- a/clang/test/Analysis/new.cpp +++ b/clang/test/Analysis/new.cpp @@ -94,6 +94,14 @@ void testNewInvalidationScalarPlacement(int **p) { new (p) (int *)(static_cast<int *>(malloc(4))); // no-warning } +void testCacheOut(PtrWrapper w) { + extern bool coin(); + if (coin()) + w.x = 0; + new (&w.x) (int*)(0); // we cache out here; don't crash +} + + //-------------------------------------------------------------------- // Check for intersection with other checkers from MallocChecker.cpp // bounded with unix.Malloc |

