diff options
author | John McCall <rjmccall@apple.com> | 2010-12-04 08:24:19 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-12-04 08:24:19 +0000 |
commit | 9c5d70cee1fab3f988f9cd40316071b088a3f19d (patch) | |
tree | f90a0930eb00f694f1e0b9dc57390459594b44a0 /lib/AST/Expr.cpp | |
parent | ec276bf91627058a61adc9ba9175dd10d4c1a5aa (diff) |
Make IgnoreParenLValueCasts skip __extension__ nodes like IgnoreParens().
Abramo noticed this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120898 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index fbc5a67af1..eef45e388a 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1724,18 +1724,26 @@ Expr *Expr::IgnoreParenCasts() { } } +/// IgnoreParenLValueCasts - Ignore parentheses and lvalue-to-rvalue +/// casts. This is intended purely as a temporary workaround for code +/// that hasn't yet been rewritten to do the right thing about those +/// casts, and may disappear along with the last internal use. Expr *Expr::IgnoreParenLValueCasts() { Expr *E = this; - while (E) { + while (true) { if (ParenExpr *P = dyn_cast<ParenExpr>(E)) { E = P->getSubExpr(); continue; - } - if (CastExpr *P = dyn_cast<CastExpr>(E)) { + } else if (CastExpr *P = dyn_cast<CastExpr>(E)) { if (P->getCastKind() == CK_LValueToRValue) { E = P->getSubExpr(); continue; } + } else if (UnaryOperator* P = dyn_cast<UnaryOperator>(E)) { + if (P->getOpcode() == UO_Extension) { + E = P->getSubExpr(); + continue; + } } break; } |