зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
7e21ffb97e
Коммит
2fc46bf1a9
|
@ -321,6 +321,10 @@ public:
|
|||
/// or CastExprs, returning their operand.
|
||||
Expr *IgnoreParenCasts();
|
||||
|
||||
/// IgnoreParenImpCasts - Ignore parentheses and implicit casts. Strip off any
|
||||
/// ParenExpr or ImplicitCastExprs, returning their operand.
|
||||
Expr *IgnoreParenImpCasts();
|
||||
|
||||
/// 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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче