diff options
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 40 | ||||
| -rw-r--r-- | clang/lib/AST/ExprClassification.cpp | 18 | ||||
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/AST/StmtDumper.cpp | 34 | ||||
| -rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 18 | ||||
| -rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 19 |
6 files changed, 35 insertions, 95 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 6e56603c53e..265788a0817 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/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; } diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp index 4025f18a3b4..e55545e6936 100644 --- a/clang/lib/AST/ExprClassification.cpp +++ b/clang/lib/AST/ExprClassification.cpp @@ -104,7 +104,6 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { case Expr::PredefinedExprClass: // Property references are lvalues case Expr::ObjCPropertyRefExprClass: - case Expr::ObjCImplicitSetterGetterRefExprClass: // C++ [expr.typeid]p1: The result of a typeid expression is an lvalue of... case Expr::CXXTypeidExprClass: // Unresolved lookups get classified as lvalues. @@ -195,8 +194,7 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { Cl::Kinds K = ClassifyInternal(Ctx, Op); if (K != Cl::CL_LValue) return K; - if (isa<ObjCPropertyRefExpr>(Op) || - isa<ObjCImplicitSetterGetterRefExpr>(Op)) + if (isa<ObjCPropertyRefExpr>(Op)) return Cl::CL_SubObjCPropertySetting; return Cl::CL_LValue; } @@ -368,8 +366,7 @@ static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E) { return Cl::CL_LValue; // ObjC property accesses are not lvalues, but get special treatment. Expr *Base = E->getBase()->IgnoreParens(); - if (isa<ObjCPropertyRefExpr>(Base) || - isa<ObjCImplicitSetterGetterRefExpr>(Base)) + if (isa<ObjCPropertyRefExpr>(Base)) return Cl::CL_SubObjCPropertySetting; return ClassifyInternal(Ctx, Base); } @@ -395,8 +392,7 @@ static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E) { if (E->isArrow()) return Cl::CL_LValue; Expr *Base = E->getBase()->IgnoreParenImpCasts(); - if (isa<ObjCPropertyRefExpr>(Base) || - isa<ObjCImplicitSetterGetterRefExpr>(Base)) + if (isa<ObjCPropertyRefExpr>(Base)) return Cl::CL_SubObjCPropertySetting; return ClassifyInternal(Ctx, E->getBase()); } @@ -498,9 +494,8 @@ static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E, // Assignment to a property in ObjC is an implicit setter access. But a // setter might not exist. - if (const ObjCImplicitSetterGetterRefExpr *Expr = - dyn_cast<ObjCImplicitSetterGetterRefExpr>(E)) { - if (Expr->getSetterMethod() == 0) + if (const ObjCPropertyRefExpr *Expr = dyn_cast<ObjCPropertyRefExpr>(E)) { + if (Expr->isImplicitProperty() && Expr->getImplicitPropertySetter() == 0) return Cl::CM_NoSetterProperty; } @@ -517,8 +512,7 @@ static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E, // Records with any const fields (recursively) are not modifiable. if (const RecordType *R = CT->getAs<RecordType>()) { - assert((isa<ObjCImplicitSetterGetterRefExpr>(E) || - isa<ObjCPropertyRefExpr>(E) || + assert((isa<ObjCPropertyRefExpr>(E) || !Ctx.getLangOptions().CPlusPlus) && "C++ struct assignment should be resolved by the " "copy assignment operator."); diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index f4685933dcc..019cfc9b800 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -2506,7 +2506,6 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) { case Expr::ObjCProtocolExprClass: case Expr::ObjCIvarRefExprClass: case Expr::ObjCPropertyRefExprClass: - case Expr::ObjCImplicitSetterGetterRefExprClass: case Expr::ObjCIsaExprClass: case Expr::ShuffleVectorExprClass: case Expr::BlockExprClass: diff --git a/clang/lib/AST/StmtDumper.cpp b/clang/lib/AST/StmtDumper.cpp index 15a8d61c885..6f9a2d574bd 100644 --- a/clang/lib/AST/StmtDumper.cpp +++ b/clang/lib/AST/StmtDumper.cpp @@ -172,8 +172,6 @@ namespace { void VisitObjCSelectorExpr(ObjCSelectorExpr *Node); void VisitObjCProtocolExpr(ObjCProtocolExpr *Node); void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node); - void VisitObjCImplicitSetterGetterRefExpr( - ObjCImplicitSetterGetterRefExpr *Node); void VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node); }; } @@ -607,27 +605,19 @@ void StmtDumper::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) { void StmtDumper::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) { DumpExpr(Node); - if (Node->isSuperReceiver()) - OS << " Kind=PropertyRef Property=\"" << Node->getProperty() << '"' - << " super"; - else - OS << " Kind=PropertyRef Property=\"" << Node->getProperty() << '"'; -} - -void StmtDumper::VisitObjCImplicitSetterGetterRefExpr( - ObjCImplicitSetterGetterRefExpr *Node) { - DumpExpr(Node); + if (Node->isImplicitProperty()) { + OS << " Kind=MethodRef Getter=\"" + << Node->getImplicitPropertyGetter()->getSelector().getAsString() + << "\" Setter=\""; + if (ObjCMethodDecl *Setter = Node->getImplicitPropertySetter()) + OS << Setter->getSelector().getAsString(); + else + OS << "(null)"; + OS << "\""; + } else { + OS << " Kind=PropertyRef Property=\"" << Node->getExplicitProperty() << '"'; + } - ObjCMethodDecl *Getter = Node->getGetterMethod(); - ObjCMethodDecl *Setter = Node->getSetterMethod(); - OS << " Kind=MethodRef Getter=\"" - << Getter->getSelector().getAsString() - << "\" Setter=\""; - if (Setter) - OS << Setter->getSelector().getAsString(); - else - OS << "(null)"; - OS << "\""; if (Node->isSuperReceiver()) OS << " super"; } diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index d4791bcd0ec..9dfde62deb6 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -516,20 +516,10 @@ void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) { OS << "."; } - OS << Node->getProperty()->getName(); -} - -void StmtPrinter::VisitObjCImplicitSetterGetterRefExpr( - ObjCImplicitSetterGetterRefExpr *Node) { - if (Node->isSuperReceiver()) - OS << "super."; - else if (Node->getBase()) { - PrintExpr(Node->getBase()); - OS << "."; - } - if (Node->getGetterMethod()) - OS << Node->getGetterMethod(); - + if (Node->isImplicitProperty()) + OS << Node->getImplicitPropertyGetter()->getSelector().getAsString(); + else + OS << Node->getExplicitProperty()->getName(); } void StmtPrinter::VisitPredefinedExpr(PredefinedExpr *Node) { diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index d67f5fad6bf..7f10bef7134 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -866,22 +866,15 @@ void StmtProfiler::VisitObjCIvarRefExpr(ObjCIvarRefExpr *S) { void StmtProfiler::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *S) { VisitExpr(S); - VisitDecl(S->getProperty()); - if (S->isSuperReceiver()) { - ID.AddBoolean(S->isSuperReceiver()); - VisitType(S->getSuperType()); + if (S->isImplicitProperty()) { + VisitDecl(S->getImplicitPropertyGetter()); + VisitDecl(S->getImplicitPropertySetter()); + } else { + VisitDecl(S->getExplicitProperty()); } -} - -void StmtProfiler::VisitObjCImplicitSetterGetterRefExpr( - ObjCImplicitSetterGetterRefExpr *S) { - VisitExpr(S); - VisitDecl(S->getGetterMethod()); - VisitDecl(S->getSetterMethod()); - VisitDecl(S->getInterfaceDecl()); if (S->isSuperReceiver()) { ID.AddBoolean(S->isSuperReceiver()); - VisitType(S->getSuperType()); + VisitType(S->getSuperReceiverType()); } } |

