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 | 5a4ce8bf06ad66941e0c9466f2c68c68bcae33bf (patch) | |
| tree | 6ccf192d71c287bfccc02a3a317e47d0c2b26d9f /clang/lib | |
| parent | b024166c976cfa1d7bb6a15a7ee20c917878824e (diff) | |
| download | bcm5719-llvm-5a4ce8bf06ad66941e0c9466f2c68c68bcae33bf.tar.gz bcm5719-llvm-5a4ce8bf06ad66941e0c9466f2c68c68bcae33bf.zip | |
Make IgnoreParenLValueCasts skip __extension__ nodes like IgnoreParens().
Abramo noticed this.
llvm-svn: 120898
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 14 | 
1 files changed, 11 insertions, 3 deletions
| diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index fbc5a67af1f..eef45e388a9 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/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;    } | 

