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/lib/StaticAnalyzer/Core/ExprEngineCXX.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/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp index c1dd6b22209..64c361d4d8e 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp @@ -351,15 +351,16 @@ void ExprEngine::VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred, State = State->BindExpr(CNE, LCtx, symVal); } - Bldr.generateNode(CNE, Pred, State); + ExplodedNode *NewN = Bldr.generateNode(CNE, Pred, State); + if (!NewN) + return; // If the type is not a record, we won't have a CXXConstructExpr as an // initializer. Copy the value over. if (const Expr *Init = CNE->getInitializer()) { if (!isa<CXXConstructExpr>(Init)) { assert(Bldr.getResults().size() == 1); - ExplodedNode *TmpN = *Bldr.getResults().begin(); - Bldr.takeNodes(TmpN); + Bldr.takeNodes(NewN); assert(!CNE->getType()->getPointeeCXXRecordDecl()); |