diff options
author | John McCall <rjmccall@apple.com> | 2010-12-02 01:19:52 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-12-02 01:19:52 +0000 |
commit | 12f78a6741a4cb3d904340f8d3d2714568b50e7a (patch) | |
tree | 7d3c0d003eb7060d7a7a985d6f4fa284f9207c35 /lib/AST/Expr.cpp | |
parent | 9d0b2b728b9a431546b11252793844bf7506ec84 (diff) |
Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120643 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 6e56603c53..265788a081 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1338,21 +1338,11 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1, return false; } - case ObjCImplicitSetterGetterRefExprClass: { // Dot syntax for message send. -#if 0 - const ObjCImplicitSetterGetterRefExpr *Ref = - cast<ObjCImplicitSetterGetterRefExpr>(this); - // FIXME: We really want the location of the '.' here. - Loc = Ref->getLocation(); - R1 = SourceRange(Ref->getLocation(), Ref->getLocation()); - if (Ref->getBase()) - R2 = Ref->getBase()->getSourceRange(); -#else + case ObjCPropertyRefExprClass: Loc = getExprLoc(); R1 = getSourceRange(); -#endif return true; - } + case StmtExprClass: { // Statement exprs don't logically have side effects themselves, but are // sometimes used in macros in ways that give them a type that is unused. @@ -1635,7 +1625,6 @@ Expr::CanThrowResult Expr::CanThrow(ASTContext &C) const { // specs. case ObjCMessageExprClass: case ObjCPropertyRefExprClass: - case ObjCImplicitSetterGetterRefExprClass: return CT_Can; // Many other things have subexpressions, so we have to test those. @@ -1838,8 +1827,7 @@ bool Expr::isTemporaryObject(ASTContext &C, const CXXRecordDecl *TempTy) const { // Temporaries are by definition pr-values of class type. if (!E->Classify(C).isPRValue()) { // In this context, property reference is a message call and is pr-value. - if (!isa<ObjCPropertyRefExpr>(E) && - !isa<ObjCImplicitSetterGetterRefExpr>(E)) + if (!isa<ObjCPropertyRefExpr>(E)) return false; } @@ -2537,33 +2525,19 @@ Stmt::child_iterator ObjCIvarRefExpr::child_end() { return &Base+1; } // ObjCPropertyRefExpr Stmt::child_iterator ObjCPropertyRefExpr::child_begin() { - if (BaseExprOrSuperType.is<Stmt*>()) { + if (Receiver.is<Stmt*>()) { // Hack alert! - return reinterpret_cast<Stmt**> (&BaseExprOrSuperType); + return reinterpret_cast<Stmt**> (&Receiver); } return child_iterator(); } Stmt::child_iterator ObjCPropertyRefExpr::child_end() -{ return BaseExprOrSuperType.is<Stmt*>() ? - reinterpret_cast<Stmt**> (&BaseExprOrSuperType)+1 : +{ return Receiver.is<Stmt*>() ? + reinterpret_cast<Stmt**> (&Receiver)+1 : child_iterator(); } -// ObjCImplicitSetterGetterRefExpr -Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_begin() { - // If this is accessing a class member or super, skip that entry. - // Technically, 2nd condition is sufficient. But I want to be verbose - if (isSuperReceiver() || !Base) - return child_iterator(); - return &Base; -} -Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_end() { - if (isSuperReceiver() || !Base) - return child_iterator(); - return &Base+1; -} - // ObjCIsaExpr Stmt::child_iterator ObjCIsaExpr::child_begin() { return &Base; } Stmt::child_iterator ObjCIsaExpr::child_end() { return &Base+1; } |