diff options
author | John McCall <rjmccall@apple.com> | 2010-05-05 22:59:52 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-05-05 22:59:52 +0000 |
commit | 2fc46bf1a9bc31d50f82de37c70ea257d3cded27 (patch) | |
tree | e8696507d3384d78c25b96ffa4f1486da16f8581 /lib/AST/Expr.cpp | |
parent | 7e21ffb97e1da7ee5470865859c5b4bfbe0b91a3 (diff) |
Add IgnoreParenImpCasts() to Expr, which is basically like IgnoreParenCasts
except it only skips implicit casts.
Also fix ObjCImplicitGetterSetterRefExpr's child_begin to skip the base expression
if it's actually a type reference (which you get with static property references).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 057d542b6d..417bc964c8 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1557,6 +1557,18 @@ Expr *Expr::IgnoreParenCasts() { } } +Expr *Expr::IgnoreParenImpCasts() { + Expr *E = this; + while (true) { + if (ParenExpr *P = dyn_cast<ParenExpr>(E)) + E = P->getSubExpr(); + else if (ImplicitCastExpr *P = dyn_cast<ImplicitCastExpr>(E)) + E = P->getSubExpr(); + else + return E; + } +} + /// IgnoreParenNoopCasts - Ignore parentheses and casts that do not change the /// value (including ptr->int casts of the same size). Strip off any /// ParenExpr or CastExprs, returning their operand. @@ -2712,7 +2724,9 @@ Stmt::child_iterator ObjCPropertyRefExpr::child_end() { return &Base+1; } // ObjCImplicitSetterGetterRefExpr Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_begin() { - return &Base; + // If this is accessing a class member, skip that entry. + if (Base) return &Base; + return &Base+1; } Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_end() { return &Base+1; |