[cfe-commits] r120898 - /cfe/trunk/lib/AST/Expr.cpp
John McCall
rjmccall at apple.com
Sat Dec 4 00:24:19 PST 2010
Author: rjmccall
Date: Sat Dec 4 02:24:19 2010
New Revision: 120898
URL: http://llvm.org/viewvc/llvm-project?rev=120898&view=rev
Log:
Make IgnoreParenLValueCasts skip __extension__ nodes like IgnoreParens().
Abramo noticed this.
Modified:
cfe/trunk/lib/AST/Expr.cpp
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=120898&r1=120897&r2=120898&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sat Dec 4 02:24:19 2010
@@ -1724,18 +1724,26 @@
}
}
+/// 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;
}
More information about the cfe-commits
mailing list