summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAbramo Bagnara <abramo.bagnara@gmail.com>2010-10-15 07:51:18 +0000
committerAbramo Bagnara <abramo.bagnara@gmail.com>2010-10-15 07:51:18 +0000
commit932e393fda095c65d868610e14f129e3e511a416 (patch)
tree15820ec40e71bd5cd45bf11f6f4c3256483b8536 /clang/lib
parent12a198e5b116a3682560b0a3d35b00ff66ab77cc (diff)
downloadbcm5719-llvm-932e393fda095c65d868610e14f129e3e511a416.tar.gz
bcm5719-llvm-932e393fda095c65d868610e14f129e3e511a416.zip
Treat __extension__ like ParenExpr.
llvm-svn: 116569
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Expr.cpp62
1 files changed, 48 insertions, 14 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 98f0656ad17..92e7119445b 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1554,10 +1554,19 @@ Expr::CanThrowResult Expr::CanThrow(ASTContext &C) const {
Expr* Expr::IgnoreParens() {
Expr* E = this;
- while (ParenExpr* P = dyn_cast<ParenExpr>(E))
- E = P->getSubExpr();
-
- return E;
+ while (true) {
+ if (ParenExpr* P = dyn_cast<ParenExpr>(E)) {
+ E = P->getSubExpr();
+ continue;
+ }
+ if (UnaryOperator* P = dyn_cast<UnaryOperator>(E)) {
+ if (P->getOpcode() == UO_Extension) {
+ E = P->getSubExpr();
+ continue;
+ }
+ }
+ return E;
+ }
}
/// IgnoreParenCasts - Ignore parentheses and casts. Strip off any ParenExpr
@@ -1565,24 +1574,42 @@ Expr* Expr::IgnoreParens() {
Expr *Expr::IgnoreParenCasts() {
Expr *E = this;
while (true) {
- if (ParenExpr *P = dyn_cast<ParenExpr>(E))
+ if (ParenExpr* P = dyn_cast<ParenExpr>(E)) {
E = P->getSubExpr();
- else if (CastExpr *P = dyn_cast<CastExpr>(E))
+ continue;
+ }
+ if (CastExpr *P = dyn_cast<CastExpr>(E)) {
E = P->getSubExpr();
- else
- return E;
+ continue;
+ }
+ if (UnaryOperator* P = dyn_cast<UnaryOperator>(E)) {
+ if (P->getOpcode() == UO_Extension) {
+ E = P->getSubExpr();
+ continue;
+ }
+ }
+ return E;
}
}
Expr *Expr::IgnoreParenImpCasts() {
Expr *E = this;
while (true) {
- if (ParenExpr *P = dyn_cast<ParenExpr>(E))
+ if (ParenExpr *P = dyn_cast<ParenExpr>(E)) {
E = P->getSubExpr();
- else if (ImplicitCastExpr *P = dyn_cast<ImplicitCastExpr>(E))
+ continue;
+ }
+ if (ImplicitCastExpr *P = dyn_cast<ImplicitCastExpr>(E)) {
E = P->getSubExpr();
- else
- return E;
+ continue;
+ }
+ if (UnaryOperator* P = dyn_cast<UnaryOperator>(E)) {
+ if (P->getOpcode() == UO_Extension) {
+ E = P->getSubExpr();
+ continue;
+ }
+ }
+ return E;
}
}
@@ -1607,9 +1634,9 @@ Expr *Expr::IgnoreParenNoopCasts(ASTContext &Ctx) {
continue;
}
- if ((E->getType()->isPointerType() ||
+ if ((E->getType()->isPointerType() ||
E->getType()->isIntegralType(Ctx)) &&
- (SE->getType()->isPointerType() ||
+ (SE->getType()->isPointerType() ||
SE->getType()->isIntegralType(Ctx)) &&
Ctx.getTypeSize(E->getType()) == Ctx.getTypeSize(SE->getType())) {
E = SE;
@@ -1617,6 +1644,13 @@ Expr *Expr::IgnoreParenNoopCasts(ASTContext &Ctx) {
}
}
+ if (UnaryOperator* P = dyn_cast<UnaryOperator>(E)) {
+ if (P->getOpcode() == UO_Extension) {
+ E = P->getSubExpr();
+ continue;
+ }
+ }
+
return E;
}
}
OpenPOWER on IntegriCloud