diff options
| author | Jordan Rose <jordan_rose@apple.com> | 2013-06-06 01:57:24 +0000 |
|---|---|---|
| committer | Jordan Rose <jordan_rose@apple.com> | 2013-06-06 01:57:24 +0000 |
| commit | 69dd5fce3e3b2b52323eb7daed03e4272860d210 (patch) | |
| tree | 511595e19da1127e477e6fb5f26d10c48efd8a97 /clang/lib | |
| parent | d2f8a6a993f9aaec0d570596154fed4d6d9b85f1 (diff) | |
| download | bcm5719-llvm-69dd5fce3e3b2b52323eb7daed03e4272860d210.tar.gz bcm5719-llvm-69dd5fce3e3b2b52323eb7daed03e4272860d210.zip | |
[analyzer] Look through ExprWithCleanups to see if an expr's consumed.
We based decisions during analysis and during path generation on whether
or not an expression is consumed, so if a top-level expression has
cleanups it's important for us to look through that.
<rdar://problem/14076125>
llvm-svn: 183368
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ParentMap.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp index a9a459b602b..dbe0b98e186 100644 --- a/clang/lib/AST/ParentMap.cpp +++ b/clang/lib/AST/ParentMap.cpp @@ -14,6 +14,7 @@ #include "clang/AST/ParentMap.h" #include "clang/AST/Decl.h" #include "clang/AST/Expr.h" +#include "clang/AST/ExprCXX.h" #include "llvm/ADT/DenseMap.h" using namespace clang; @@ -150,8 +151,9 @@ bool ParentMap::isConsumedExpr(Expr* E) const { Stmt *P = getParent(E); Stmt *DirectChild = E; - // Ignore parents that are parentheses or casts. - while (P && (isa<ParenExpr>(P) || isa<CastExpr>(P))) { + // Ignore parents that don't guarantee consumption. + while (P && (isa<ParenExpr>(P) || isa<CastExpr>(P) || + isa<ExprWithCleanups>(P))) { DirectChild = P; P = getParent(P); } |

