diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-08-31 05:10:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-08-31 05:10:27 +0000 |
commit | 35fe7eeb1284ed786ed647b34fa01fc18646b3c7 (patch) | |
tree | 713a2e721093691550ceead05c93b62cb6e3ed95 | |
parent | c238f09a268cd87a2568f6c97181252687ae07b1 (diff) |
Teach the CFGBuilder not do die on CXXBindTemporaryExpr, CXXOperatorCallExpr. Fixes a Boost.Graph crasher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112578 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/CFG.cpp | 7 | ||||
-rw-r--r-- | test/Analysis/temporaries.cpp | 13 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 78979a4fee..ea30ec01f6 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -370,6 +370,7 @@ tryAgain: return VisitBreakStmt(cast<BreakStmt>(S)); case Stmt::CallExprClass: + case Stmt::CXXOperatorCallExprClass: // FIXME: handle specially? return VisitCallExpr(cast<CallExpr>(S), asc); case Stmt::CaseStmtClass: @@ -396,6 +397,12 @@ tryAgain: return Visit(cast<CXXExprWithTemporaries>(S)->getSubExpr()); } + case Stmt::CXXBindTemporaryExprClass: { + // FIXME: Handle temporary binding. For now, just visit the subexpression + // so we don't artificially create extra blocks. + return Visit(cast<CXXBindTemporaryExpr>(S)->getSubExpr()); + } + case Stmt::CXXMemberCallExprClass: return VisitCXXMemberCallExpr(cast<CXXMemberCallExpr>(S), asc); diff --git a/test/Analysis/temporaries.cpp b/test/Analysis/temporaries.cpp new file mode 100644 index 0000000000..602948af5c --- /dev/null +++ b/test/Analysis/temporaries.cpp @@ -0,0 +1,13 @@ +// // RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s + +// FIXME: Super-simple test to make sure we don't die on temporaries. + +struct X { + X(); + ~X(); + X operator++(int); +}; + +int f(X x, X y) { + for (; ; x++) { } +} |