diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-18 20:50:23 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-18 20:50:23 +0000 |
commit | 154440e6a8fa6ac5bca395876d79b530b39a2c1c (patch) | |
tree | 0e2cb0ba45e69bfb532ce6002a3f1a91780a9c42 | |
parent | f53b4433abb7a3bc14c0329d3175cbc291280137 (diff) |
Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.
Removed an unnecessary loop to get to setters incoming
argument. Added DoxyGen comments. Still more work
to do in this area (WIP).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79365 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/ExprObjC.h | 38 | ||||
-rw-r--r-- | include/clang/AST/StmtNodes.def | 2 | ||||
-rw-r--r-- | include/clang/Frontend/PCHBitCodes.h | 2 | ||||
-rw-r--r-- | lib/AST/Expr.cpp | 32 | ||||
-rw-r--r-- | lib/AST/StmtDumper.cpp | 6 | ||||
-rw-r--r-- | lib/AST/StmtPrinter.cpp | 7 | ||||
-rw-r--r-- | lib/AST/StmtProfile.cpp | 3 | ||||
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 9 | ||||
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 5 | ||||
-rw-r--r-- | lib/CodeGen/CGExprComplex.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/CGValue.h | 9 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 2 | ||||
-rw-r--r-- | lib/Frontend/PCHReaderStmt.cpp | 8 | ||||
-rw-r--r-- | lib/Frontend/PCHWriterStmt.cpp | 6 | ||||
-rw-r--r-- | lib/Frontend/StmtXML.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 20 | ||||
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 3 | ||||
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/TreeTransform.h | 3 |
22 files changed, 108 insertions, 73 deletions
diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h index d04d4977a0..03d54afa02 100644 --- a/include/clang/AST/ExprObjC.h +++ b/include/clang/AST/ExprObjC.h @@ -257,13 +257,24 @@ public: virtual child_iterator child_end(); }; -/// ObjCKVCRefExpr - A dot-syntax expression to access "implicit" properties -/// (i.e. methods following the property naming convention). KVC stands for -/// Key Value Encoding, a generic concept for accessing or setting a 'Key' -/// value for an object. -/// -class ObjCKVCRefExpr : public Expr { +/// ObjCImplctSetterGetterRefExpr - A dot-syntax expression to access two +/// methods; one to set a value to an 'ivar' (Setter) and the other to access +/// an 'ivar' (Setter). +/// An example for use of this AST is: +/// @code +/// @interface Test { } +/// - (Test *)crash; +/// - (void)setCrash: (Test*)value; +/// @end +/// void foo(Test *p1, Test *p2) +/// { +/// p2.crash = p1.crash; // Uses ObjCImplctSetterGetterRefExpr AST +/// } +/// @endcode +class ObjCImplctSetterGetterRefExpr : public Expr { + /// Setter - Setter method user declared for setting its 'ivar' to a value ObjCMethodDecl *Setter; + /// Getter - Getter method user declared for accessing 'ivar' it controls. ObjCMethodDecl *Getter; SourceLocation Loc; // FIXME: Swizzle these into a single pointer. @@ -272,22 +283,23 @@ class ObjCKVCRefExpr : public Expr { SourceLocation ClassLoc; public: - ObjCKVCRefExpr(ObjCMethodDecl *getter, + ObjCImplctSetterGetterRefExpr(ObjCMethodDecl *getter, QualType t, ObjCMethodDecl *setter, SourceLocation l, Expr *base) - : Expr(ObjCKVCRefExprClass, t), Setter(setter), + : Expr(ObjCImplctSetterGetterRefExprClass, t), Setter(setter), Getter(getter), Loc(l), Base(base), ClassProp(0), ClassLoc(SourceLocation()) { } - ObjCKVCRefExpr(ObjCMethodDecl *getter, + ObjCImplctSetterGetterRefExpr(ObjCMethodDecl *getter, QualType t, ObjCMethodDecl *setter, SourceLocation l, ObjCInterfaceDecl *C, SourceLocation CL) - : Expr(ObjCKVCRefExprClass, t), Setter(setter), + : Expr(ObjCImplctSetterGetterRefExprClass, t), Setter(setter), Getter(getter), Loc(l), Base(0), ClassProp(C), ClassLoc(CL) { } - explicit ObjCKVCRefExpr(EmptyShell Empty) : Expr(ObjCKVCRefExprClass, Empty){} + explicit ObjCImplctSetterGetterRefExpr(EmptyShell Empty) + : Expr(ObjCImplctSetterGetterRefExprClass, Empty){} ObjCMethodDecl *getGetterMethod() const { return Getter; } ObjCMethodDecl *getSetterMethod() const { return Setter; } @@ -311,9 +323,9 @@ public: void setClassLoc(SourceLocation L) { ClassLoc = L; } static bool classof(const Stmt *T) { - return T->getStmtClass() == ObjCKVCRefExprClass; + return T->getStmtClass() == ObjCImplctSetterGetterRefExprClass; } - static bool classof(const ObjCKVCRefExpr *) { return true; } + static bool classof(const ObjCImplctSetterGetterRefExpr *) { return true; } // Iterators virtual child_iterator child_begin(); diff --git a/include/clang/AST/StmtNodes.def b/include/clang/AST/StmtNodes.def index e278d1763a..ebbeba2ac2 100644 --- a/include/clang/AST/StmtNodes.def +++ b/include/clang/AST/StmtNodes.def @@ -144,7 +144,7 @@ EXPR(ObjCSelectorExpr , Expr) EXPR(ObjCProtocolExpr , Expr) EXPR(ObjCIvarRefExpr , Expr) EXPR(ObjCPropertyRefExpr , Expr) -EXPR(ObjCKVCRefExpr , Expr) +EXPR(ObjCImplctSetterGetterRefExpr , Expr) EXPR(ObjCSuperExpr , Expr) EXPR(ObjCIsaExpr , Expr) diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h index 15f5518210..f4284e9c5c 100644 --- a/include/clang/Frontend/PCHBitCodes.h +++ b/include/clang/Frontend/PCHBitCodes.h @@ -636,7 +636,7 @@ namespace clang { EXPR_OBJC_IVAR_REF_EXPR, /// \brief An ObjCPropertyRefExpr record. EXPR_OBJC_PROPERTY_REF_EXPR, - /// \brief An ObjCKVCRefExpr record. + /// \brief An ObjCImplctSetterGetterRefExpr record. EXPR_OBJC_KVC_REF_EXPR, /// \brief An ObjCMessageExpr record. EXPR_OBJC_MESSAGE_EXPR, diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index ec44584585..225f177903 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -542,14 +542,15 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1, case ObjCMessageExprClass: return false; - case ObjCKVCRefExprClass: { // Dot syntax for message send. + case ObjCImplctSetterGetterRefExprClass: { // Dot syntax for message send. #if 0 - const ObjCKVCRefExpr *KVCRef = cast<ObjCKVCRefExpr>(this); + const ObjCImplctSetterGetterRefExpr *Ref = + cast<ObjCImplctSetterGetterRefExpr>(this); // FIXME: We really want the location of the '.' here. - Loc = KVCRef->getLocation(); - R1 = SourceRange(KVCRef->getLocation(), KVCRef->getLocation()); - if (KVCRef->getBase()) - R2 = KVCRef->getBase()->getSourceRange(); + Loc = Ref->getLocation(); + R1 = SourceRange(Ref->getLocation(), Ref->getLocation()); + if (Ref->getBase()) + R2 = Ref->getBase()->getSourceRange(); #else Loc = getExprLoc(); R1 = getSourceRange(); @@ -793,7 +794,7 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const { return LV_Valid; case ObjCPropertyRefExprClass: // FIXME: check if read-only property. return LV_Valid; - case ObjCKVCRefExprClass: // FIXME: check if read-only property. + case ObjCImplctSetterGetterRefExprClass: // FIXME: check if read-only property. return LV_Valid; case PredefinedExprClass: return LV_Valid; @@ -914,9 +915,10 @@ Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const { } // Assigning to an 'implicit' property? - else if (isa<ObjCKVCRefExpr>(this)) { - const ObjCKVCRefExpr* KVCExpr = cast<ObjCKVCRefExpr>(this); - if (KVCExpr->getSetterMethod() == 0) + else if (isa<ObjCImplctSetterGetterRefExpr>(this)) { + const ObjCImplctSetterGetterRefExpr* Expr = + cast<ObjCImplctSetterGetterRefExpr>(this); + if (Expr->getSetterMethod() == 0) return MLV_NoSetterProperty; } return MLV_Valid; @@ -1861,9 +1863,13 @@ Stmt::child_iterator ObjCIvarRefExpr::child_end() { return &Base+1; } Stmt::child_iterator ObjCPropertyRefExpr::child_begin() { return &Base; } Stmt::child_iterator ObjCPropertyRefExpr::child_end() { return &Base+1; } -// ObjCKVCRefExpr -Stmt::child_iterator ObjCKVCRefExpr::child_begin() { return &Base; } -Stmt::child_iterator ObjCKVCRefExpr::child_end() { return &Base+1; } +// ObjCImplctSetterGetterRefExpr +Stmt::child_iterator ObjCImplctSetterGetterRefExpr::child_begin() { + return &Base; +} +Stmt::child_iterator ObjCImplctSetterGetterRefExpr::child_end() { + return &Base+1; +} // ObjCSuperExpr Stmt::child_iterator ObjCSuperExpr::child_begin() { return child_iterator(); } diff --git a/lib/AST/StmtDumper.cpp b/lib/AST/StmtDumper.cpp index d3bd8add7f..6a48d5a47b 100644 --- a/lib/AST/StmtDumper.cpp +++ b/lib/AST/StmtDumper.cpp @@ -148,7 +148,8 @@ namespace { void VisitObjCSelectorExpr(ObjCSelectorExpr *Node); void VisitObjCProtocolExpr(ObjCProtocolExpr *Node); void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node); - void VisitObjCKVCRefExpr(ObjCKVCRefExpr *Node); + void VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *Node); void VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node); void VisitObjCSuperExpr(ObjCSuperExpr *Node); }; @@ -521,7 +522,8 @@ void StmtDumper::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) { Node->getProperty()->getNameAsString().c_str()); } -void StmtDumper::VisitObjCKVCRefExpr(ObjCKVCRefExpr *Node) { +void StmtDumper::VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *Node) { DumpExpr(Node); ObjCMethodDecl *Getter = Node->getGetterMethod(); diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index a2c04978b0..9b8dfce00e 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -518,12 +518,15 @@ void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) { OS << Node->getProperty()->getNameAsCString(); } -void StmtPrinter::VisitObjCKVCRefExpr(ObjCKVCRefExpr *Node) { +void StmtPrinter::VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *Node) { if (Node->getBase()) { PrintExpr(Node->getBase()); OS << "."; } - // FIXME: Setter/Getter names + if (Node->getGetterMethod()) + OS << Node->getGetterMethod()->getNameAsString(); + } void StmtPrinter::VisitPredefinedExpr(PredefinedExpr *Node) { diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp index 5d9b8bc7bb..cb32e8d25f 100644 --- a/lib/AST/StmtProfile.cpp +++ b/lib/AST/StmtProfile.cpp @@ -583,7 +583,8 @@ void StmtProfiler::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *S) { VisitDecl(S->getProperty()); } -void StmtProfiler::VisitObjCKVCRefExpr(ObjCKVCRefExpr *S) { +void StmtProfiler::VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *S) { VisitExpr(S); VisitDecl(S->getGetterMethod()); VisitDecl(S->getSetterMethod()); diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 740ad8a6b3..c59dafc11b 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -528,7 +528,7 @@ void GRExprEngine::VisitLValue(Expr* Ex, ExplodedNode* Pred, return; case Stmt::ObjCPropertyRefExprClass: - case Stmt::ObjCKVCRefExprClass: + case Stmt::ObjCImplctSetterGetterRefExprClass: // FIXME: Property assignments are lvalues, but not really "locations". // e.g.: self.x = something; // Here the "self.x" really can translate to a method call (setter) when @@ -2787,8 +2787,8 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, Expr* LHS = B->getLHS()->IgnoreParens(); Expr* RHS = B->getRHS()->IgnoreParens(); - // FIXME: Add proper support for ObjCKVCRefExpr. - if (isa<ObjCKVCRefExpr>(LHS)) { + // FIXME: Add proper support for ObjCImplctSetterGetterRefExpr. + if (isa<ObjCImplctSetterGetterRefExpr>(LHS)) { Visit(RHS, Pred, Dst); return; } diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 1078bacde5..3f07909ea5 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -227,8 +227,8 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) { return EmitObjCIvarRefLValue(cast<ObjCIvarRefExpr>(E)); case Expr::ObjCPropertyRefExprClass: return EmitObjCPropertyRefLValue(cast<ObjCPropertyRefExpr>(E)); - case Expr::ObjCKVCRefExprClass: - return EmitObjCKVCRefLValue(cast<ObjCKVCRefExpr>(E)); + case Expr::ObjCImplctSetterGetterRefExprClass: + return EmitObjCKVCRefLValue(cast<ObjCImplctSetterGetterRefExpr>(E)); case Expr::ObjCSuperExprClass: return EmitObjCSuperExprLValue(cast<ObjCSuperExpr>(E)); @@ -1026,7 +1026,7 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) { isUnion = true; CVRQualifiers = PTy->getPointeeType().getCVRQualifiers(); } else if (isa<ObjCPropertyRefExpr>(BaseExpr) || - isa<ObjCKVCRefExpr>(BaseExpr)) { + isa<ObjCImplctSetterGetterRefExpr>(BaseExpr)) { RValue RV = EmitObjCPropertyGet(BaseExpr); BaseValue = RV.getAggregateAddr(); if (BaseExpr->getType()->isUnionType()) @@ -1341,7 +1341,8 @@ CodeGenFunction::EmitObjCPropertyRefLValue(const ObjCPropertyRefExpr *E) { } LValue -CodeGenFunction::EmitObjCKVCRefLValue(const ObjCKVCRefExpr *E) { +CodeGenFunction::EmitObjCKVCRefLValue( + const ObjCImplctSetterGetterRefExpr *E) { // This is a special l-value that just issues sends when we load or // store through it. return LValue::MakeKVCRef(E, E->getType().getCVRQualifiers()); diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 68341a12b1..1c1fc9b451 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -99,7 +99,7 @@ public: EmitAggLoadOfLValue(E); } void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E); - void VisitObjCKVCRefExpr(ObjCKVCRefExpr *E); + void VisitObjCImplctSetterGetterRefExpr(ObjCImplctSetterGetterRefExpr *E); void VisitConditionalOperator(const ConditionalOperator *CO); void VisitChooseExpr(const ChooseExpr *CE); @@ -208,7 +208,8 @@ void AggExprEmitter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { EmitFinalDestCopy(E, RV); } -void AggExprEmitter::VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) { +void AggExprEmitter::VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *E) { RValue RV = CGF.EmitObjCPropertyGet(E); EmitFinalDestCopy(E, RV); } diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp index f8e125a7bb..b23588cfce 100644 --- a/lib/CodeGen/CGExprComplex.cpp +++ b/lib/CodeGen/CGExprComplex.cpp @@ -120,7 +120,8 @@ public: ComplexPairTy VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { return EmitLoadOfLValue(E); } - ComplexPairTy VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) { + ComplexPairTy VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *E) { return EmitLoadOfLValue(E); } ComplexPairTy VisitObjCMessageExpr(ObjCMessageExpr *E) { diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 37d2995142..5650ed7425 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -158,7 +158,8 @@ public: Value *VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { return EmitLoadOfLValue(E); } - Value *VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) { + Value *VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *E) { return EmitLoadOfLValue(E); } Value *VisitObjCMessageExpr(ObjCMessageExpr *E) { diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index c9c9b0aa47..8a942d6537 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -337,7 +337,8 @@ RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp) { EmitScalarExpr(E->getBase()), false, CallArgList()); } else { - const ObjCKVCRefExpr *KE = cast<ObjCKVCRefExpr>(Exp); + const ObjCImplctSetterGetterRefExpr *KE = + cast<ObjCImplctSetterGetterRefExpr>(Exp); Selector S = KE->getGetterMethod()->getSelector(); llvm::Value *Receiver; if (KE->getClassProp()) { @@ -388,7 +389,8 @@ void CodeGenFunction::EmitObjCPropertySet(const Expr *Exp, CGM.getObjCRuntime().GenerateMessageSend(*this, getContext().VoidTy, S, EmitScalarExpr(E->getBase()), false, Args); - } else if (const ObjCKVCRefExpr *E = dyn_cast<ObjCKVCRefExpr>(Exp)) { + } else if (const ObjCImplctSetterGetterRefExpr *E = + dyn_cast<ObjCImplctSetterGetterRefExpr>(Exp)) { Selector S = E->getSetterMethod()->getSelector(); CallArgList Args; llvm::Value *Receiver; diff --git a/lib/CodeGen/CGValue.h b/lib/CodeGen/CGValue.h index 9e937085a9..15020e9157 100644 --- a/lib/CodeGen/CGValue.h +++ b/lib/CodeGen/CGValue.h @@ -24,7 +24,7 @@ namespace llvm { namespace clang { class ObjCPropertyRefExpr; - class ObjCKVCRefExpr; + class ObjCImplctSetterGetterRefExpr; namespace CodeGen { @@ -143,7 +143,7 @@ class LValue { // Obj-C property reference expression const ObjCPropertyRefExpr *PropertyRefExpr; // ObjC 'implicit' property reference expression - const ObjCKVCRefExpr *KVCRefExpr; + const ObjCImplctSetterGetterRefExpr *KVCRefExpr; }; bool Volatile:1; @@ -251,7 +251,7 @@ public: } // 'implicit' property ref lvalue - const ObjCKVCRefExpr *getKVCRefExpr() const { + const ObjCImplctSetterGetterRefExpr *getKVCRefExpr() const { assert(isKVCRef()); return KVCRefExpr; } @@ -313,7 +313,8 @@ public: return R; } - static LValue MakeKVCRef(const ObjCKVCRefExpr *E, unsigned Qualifiers) { + static LValue MakeKVCRef(const ObjCImplctSetterGetterRefExpr *E, + unsigned Qualifiers) { LValue R; R.LVType = KVCRef; R.KVCRefExpr = E; diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index e2aba1b2ba..b2b02c1728 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -805,7 +805,7 @@ public: LValue EmitObjCMessageExprLValue(const ObjCMessageExpr *E); LValue EmitObjCIvarRefLValue(const ObjCIvarRefExpr *E); LValue EmitObjCPropertyRefLValue(const ObjCPropertyRefExpr *E); - LValue EmitObjCKVCRefLValue(const ObjCKVCRefExpr *E); + LValue EmitObjCKVCRefLValue(const ObjCImplctSetterGetterRefExpr *E); LValue EmitObjCSuperExprLValue(const ObjCSuperExpr *E); LValue EmitStmtExprLValue(const StmtExpr *E); diff --git a/lib/Frontend/PCHReaderStmt.cpp b/lib/Frontend/PCHReaderStmt.cpp index ccf585ce08..4d56b1b85b 100644 --- a/lib/Frontend/PCHReaderStmt.cpp +++ b/lib/Frontend/PCHReaderStmt.cpp @@ -101,7 +101,8 @@ namespace { unsigned VisitObjCProtocolExpr(ObjCProtocolExpr *E); unsigned VisitObjCIvarRefExpr(ObjCIvarRefExpr *E); unsigned VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E); - unsigned VisitObjCKVCRefExpr(ObjCKVCRefExpr *E); + unsigned VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *E); unsigned VisitObjCMessageExpr(ObjCMessageExpr *E); unsigned VisitObjCSuperExpr(ObjCSuperExpr *E); unsigned VisitObjCIsaExpr(ObjCIsaExpr *E); @@ -741,7 +742,8 @@ unsigned PCHStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { return 1; } -unsigned PCHStmtReader::VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) { +unsigned PCHStmtReader::VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *E) { VisitExpr(E); E->setGetterMethod( cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++]))); @@ -1114,7 +1116,7 @@ Stmt *PCHReader::ReadStmt(llvm::BitstreamCursor &Cursor) { S = new (Context) ObjCPropertyRefExpr(Empty); break; case pch::EXPR_OBJC_KVC_REF_EXPR: - S = new (Context) ObjCKVCRefExpr(Empty); + S = new (Context) ObjCImplctSetterGetterRefExpr(Empty); break; case pch::EXPR_OBJC_MESSAGE_EXPR: S = new (Context) ObjCMessageExpr(Empty); diff --git a/lib/Frontend/PCHWriterStmt.cpp b/lib/Frontend/PCHWriterStmt.cpp index 775834b502..389fe8744d 100644 --- a/lib/Frontend/PCHWriterStmt.cpp +++ b/lib/Frontend/PCHWriterStmt.cpp @@ -94,7 +94,8 @@ namespace { void VisitObjCProtocolExpr(ObjCProtocolExpr *E); void VisitObjCIvarRefExpr(ObjCIvarRefExpr *E); void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E); - void VisitObjCKVCRefExpr(ObjCKVCRefExpr *E); + void VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *E); void VisitObjCMessageExpr(ObjCMessageExpr *E); void VisitObjCSuperExpr(ObjCSuperExpr *E); void VisitObjCIsaExpr(ObjCIsaExpr *E); @@ -672,7 +673,8 @@ void PCHStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { Code = pch::EXPR_OBJC_PROPERTY_REF_EXPR; } -void PCHStmtWriter::VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) { +void PCHStmtWriter::VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *E) { VisitExpr(E); Writer.AddDeclRef(E->getGetterMethod(), Record); Writer.AddDeclRef(E->getSetterMethod(), Record); diff --git a/lib/Frontend/StmtXML.cpp b/lib/Frontend/StmtXML.cpp index 6ba0a28c7d..7f7b59b680 100644 --- a/lib/Frontend/StmtXML.cpp +++ b/lib/Frontend/StmtXML.cpp @@ -163,7 +163,8 @@ namespace { void VisitObjCSelectorExpr(ObjCSelectorExpr *Node); void VisitObjCProtocolExpr(ObjCProtocolExpr *Node); void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node); - void VisitObjCKVCRefExpr(ObjCKVCRefExpr *Node); + void VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *Node); void VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node); void VisitObjCSuperExpr(ObjCSuperExpr *Node); #endif @@ -438,7 +439,8 @@ void StmtXML::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) { Doc.addAttribute("property", Node->getProperty()->getNameAsString()); } -void StmtXML::VisitObjCKVCRefExpr(ObjCKVCRefExpr *Node) { +void StmtXML::VisitObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *Node) { DumpExpr(Node); ObjCMethodDecl *Getter = Node->getGetterMethod(); ObjCMethodDecl *Setter = Node->getSetterMethod(); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 6b597d117d..a7cae8a85e 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -2342,13 +2342,11 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, if (Getter) PType = Getter->getResultType(); - else { - for (ObjCMethodDecl::param_iterator PI = Setter->param_begin(), - E = Setter->param_end(); PI != E; ++PI) - PType = (*PI)->getType(); - } + else + // Get the expression type from Setter's incoming parameter. + PType = (*(Setter->param_end() -1))->getType(); // FIXME: we must check that the setter has property type. - return Owned(new (Context) ObjCKVCRefExpr(Getter, PType, + return Owned(new (Context) ObjCImplctSetterGetterRefExpr(Getter, PType, Setter, MemberLoc, BaseExpr)); } return ExprError(Diag(MemberLoc, diag::err_property_not_found) @@ -2535,13 +2533,11 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, if (Getter) PType = Getter->getResultType(); - else { - for (ObjCMethodDecl::param_iterator PI = Setter->param_begin(), - E = Setter->param_end(); PI != E; ++PI) - PType = (*PI)->getType(); - } + else + // Get the expression type from Setter's incoming parameter. + PType = (*(Setter->param_end() -1))->getType(); // FIXME: we must check that the setter has property type. - return Owned(new (Context) ObjCKVCRefExpr(Getter, PType, + return Owned(new (Context) ObjCImplctSetterGetterRefExpr(Getter, PType, Setter, MemberLoc, BaseExpr)); } return ExprError(Diag(MemberLoc, diag::err_property_not_found) diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 47ce949d02..553a32f4c9 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -338,7 +338,8 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr( E = Setter->param_end(); PI != E; ++PI) PType = (*PI)->getType(); } - return Owned(new (Context) ObjCKVCRefExpr(Getter, PType, Setter, + return Owned(new (Context) ObjCImplctSetterGetterRefExpr( + Getter, PType, Setter, propertyNameLoc, IFace, receiverNameLoc)); } return ExprError(Diag(propertyNameLoc, diag::err_property_not_found) diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index d1bb0df00d..c5841e6474 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -70,7 +70,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) { // cases now. unsigned DiagID = diag::warn_unused_expr; E = E->IgnoreParens(); - if (isa<ObjCKVCRefExpr>(E)) + if (isa<ObjCImplctSetterGetterRefExpr>(E)) DiagID = diag::warn_unused_property_expr; Diag(Loc, DiagID) << R1 << R2; diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 51db2167d9..5516ab4410 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -3409,7 +3409,8 @@ TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { template<typename Derived> Sema::OwningExprResult -TreeTransform<Derived>::TransformObjCKVCRefExpr(ObjCKVCRefExpr *E) { +TreeTransform<Derived>::TransformObjCImplctSetterGetterRefExpr( + ObjCImplctSetterGetterRefExpr *E) { // FIXME: Implement this! assert(false && "Cannot transform Objective-C expressions yet"); return SemaRef.Owned(E->Retain()); |