diff options
author | Manuel Klimek <klimek@google.com> | 2014-08-11 14:54:30 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2014-08-11 14:54:30 +0000 |
commit | 26f649f3f40b1fdf337afb4e7c46ec5639ff125c (patch) | |
tree | 8814b02aa90777a200d6e084953060d89a78ccb4 /clang/lib/StaticAnalyzer | |
parent | 97a59ae5896542ec225b96a10eae0fd185573307 (diff) | |
download | bcm5719-llvm-26f649f3f40b1fdf337afb4e7c46ec5639ff125c.tar.gz bcm5719-llvm-26f649f3f40b1fdf337afb4e7c46ec5639ff125c.zip |
Work around default parameter problem in the static analyzer.
In cases like:
struct C { ~C(); }
void f(C c = C());
void t() {
f();
}
We currently do not add the CXXBindTemporaryExpr for the temporary (the
code mentions that as the default parameter expressions are owned by
the declaration, we'd otherwise add the same expression multiple times),
but we add the temporary destructor pointing to the CXXBindTemporaryExpr.
We need to fix that before we can re-enable the assertion.
llvm-svn: 215357
Diffstat (limited to 'clang/lib/StaticAnalyzer')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index b30a4417e9a..e837f5b740a 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -671,10 +671,13 @@ void ExprEngine::ProcessTemporaryDtor(const CFGTemporaryDtor D, ExplodedNodeSet CleanDtorState; StmtNodeBuilder StmtBldr(Pred, CleanDtorState, *currBldrCtx); ProgramStateRef State = Pred->getState(); - assert(State->contains<InitializedTemporariesSet>( - std::make_pair(D.getBindTemporaryExpr(), Pred->getStackFrame()))); - State = State->remove<InitializedTemporariesSet>( - std::make_pair(D.getBindTemporaryExpr(), Pred->getStackFrame())); + if (State->contains<InitializedTemporariesSet>( + std::make_pair(D.getBindTemporaryExpr(), Pred->getStackFrame()))) { + // FIXME: Currently we insert temporary destructors for default parameters, + // but we don't insert the constructors. + State = State->remove<InitializedTemporariesSet>( + std::make_pair(D.getBindTemporaryExpr(), Pred->getStackFrame())); + } StmtBldr.generateNode(D.getBindTemporaryExpr(), Pred, State); QualType varType = D.getBindTemporaryExpr()->getSubExpr()->getType(); |