[cfe-commits] r120643 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Serialization/ lib/AST/ lib/Checker/ lib/CodeGen/ lib/Rewrite/ lib/Sema/ lib/Serialization/ tools/libclang/

John McCall rjmccall at apple.com
Wed Dec 1 17:19:52 PST 2010


Author: rjmccall
Date: Wed Dec  1 19:19:52 2010
New Revision: 120643

URL: http://llvm.org/viewvc/llvm-project?rev=120643&view=rev
Log:
Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.


Modified:
    cfe/trunk/include/clang/AST/ExprObjC.h
    cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
    cfe/trunk/include/clang/Basic/StmtNodes.td
    cfe/trunk/include/clang/Serialization/ASTBitCodes.h
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/lib/AST/ExprClassification.cpp
    cfe/trunk/lib/AST/ExprConstant.cpp
    cfe/trunk/lib/AST/StmtDumper.cpp
    cfe/trunk/lib/AST/StmtPrinter.cpp
    cfe/trunk/lib/AST/StmtProfile.cpp
    cfe/trunk/lib/Checker/CheckObjCDealloc.cpp
    cfe/trunk/lib/Checker/GRExprEngine.cpp
    cfe/trunk/lib/CodeGen/CGBlocks.cpp
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp
    cfe/trunk/lib/CodeGen/CGExprComplex.cpp
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp
    cfe/trunk/lib/CodeGen/CGObjC.cpp
    cfe/trunk/lib/CodeGen/CGValue.h
    cfe/trunk/lib/CodeGen/CodeGenFunction.h
    cfe/trunk/lib/CodeGen/Mangle.cpp
    cfe/trunk/lib/Rewrite/RewriteObjC.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/lib/Sema/SemaStmt.cpp
    cfe/trunk/lib/Sema/TreeTransform.h
    cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
    cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
    cfe/trunk/tools/libclang/CIndex.cpp
    cfe/trunk/tools/libclang/CXCursor.cpp

Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Wed Dec  1 19:19:52 2010
@@ -14,14 +14,13 @@
 #ifndef LLVM_CLANG_AST_EXPROBJC_H
 #define LLVM_CLANG_AST_EXPROBJC_H
 
+#include "clang/AST/DeclObjC.h"
 #include "clang/AST/Expr.h"
 #include "clang/Basic/IdentifierTable.h"
 
 namespace clang {
   class IdentifierInfo;
   class ASTContext;
-  class ObjCMethodDecl;
-  class ObjCPropertyDecl;
 
 /// ObjCStringLiteral, used for Objective-C string literals
 /// i.e. @"foo".
@@ -229,17 +228,20 @@
 ///
 class ObjCPropertyRefExpr : public Expr {
 private:
-  ObjCPropertyDecl *AsProperty;
+  /// If the bool is true, this is an implicit property reference; the
+  /// pointer is an (optional) ObjCMethodDecl and Setter may be set.
+  /// if the bool is false, this is an explicit property reference;
+  /// the pointer is an ObjCPropertyDecl and Setter is always null.
+  llvm::PointerIntPair<NamedDecl*, 1, bool> PropertyOrGetter;
+  ObjCMethodDecl *Setter;
+
   SourceLocation IdLoc;
   
   /// \brief When the receiver in property access is 'super', this is
-  /// the location of the 'super' keyword.
-  SourceLocation SuperLoc;
-  
-  /// \brief When the receiver in property access is 'super', this is
-  /// the type associated with 'super' keyword. A null type indicates
-  /// that this is not a 'super' receiver.
-  llvm::PointerUnion<Stmt*, Type*> BaseExprOrSuperType;
+  /// the location of the 'super' keyword.  When it's an interface,
+  /// this is that interface.
+  SourceLocation ReceiverLoc;
+  llvm::PointerUnion3<Stmt*, Type*, ObjCInterfaceDecl*> Receiver;
   
 public:
   ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t,
@@ -247,175 +249,131 @@
                       SourceLocation l, Expr *base)
     : Expr(ObjCPropertyRefExprClass, t, VK, OK,
            /*TypeDependent=*/false, base->isValueDependent()),
-      AsProperty(PD), IdLoc(l), BaseExprOrSuperType(base) {
+      PropertyOrGetter(PD, false), Setter(0),
+      IdLoc(l), ReceiverLoc(), Receiver(base) {
   }
   
   ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t,
                       ExprValueKind VK, ExprObjectKind OK,
                       SourceLocation l, SourceLocation sl, QualType st)
-  : Expr(ObjCPropertyRefExprClass, t, VK, OK,
-         /*TypeDependent=*/false, false), 
-    AsProperty(PD), IdLoc(l), SuperLoc(sl), 
-    BaseExprOrSuperType(st.getTypePtr()) {
+    : Expr(ObjCPropertyRefExprClass, t, VK, OK,
+           /*TypeDependent=*/false, false),
+      PropertyOrGetter(PD, false), Setter(0),
+      IdLoc(l), ReceiverLoc(sl), Receiver(st.getTypePtr()) {
+  }
+
+  ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter,
+                      QualType T, ExprValueKind VK, ExprObjectKind OK,
+                      SourceLocation IdLoc, Expr *Base)
+    : Expr(ObjCPropertyRefExprClass, T, VK, OK, false,
+           Base->isValueDependent()),
+      PropertyOrGetter(Getter, true), Setter(Setter),
+      IdLoc(IdLoc), ReceiverLoc(), Receiver(Base) {
+  }
+
+  ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter,
+                      QualType T, ExprValueKind VK, ExprObjectKind OK,
+                      SourceLocation IdLoc,
+                      SourceLocation SuperLoc, QualType SuperTy)
+    : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, false),
+      PropertyOrGetter(Getter, true), Setter(Setter),
+      IdLoc(IdLoc), ReceiverLoc(SuperLoc), Receiver(SuperTy.getTypePtr()) {
+  }
+
+  ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter,
+                      QualType T, ExprValueKind VK, ExprObjectKind OK,
+                      SourceLocation IdLoc,
+                      SourceLocation ReceiverLoc, ObjCInterfaceDecl *Receiver)
+    : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, false),
+      PropertyOrGetter(Getter, true), Setter(Setter),
+      IdLoc(IdLoc), ReceiverLoc(ReceiverLoc), Receiver(Receiver) {
   }
 
   explicit ObjCPropertyRefExpr(EmptyShell Empty)
     : Expr(ObjCPropertyRefExprClass, Empty) {}
 
-  ObjCPropertyDecl *getProperty() const { return AsProperty; }
+  bool isImplicitProperty() const { return PropertyOrGetter.getInt(); }
+  bool isExplicitProperty() const { return !PropertyOrGetter.getInt(); }
 
-  const Expr *getBase() const { 
-    return cast<Expr>(BaseExprOrSuperType.get<Stmt*>()); 
-  }
-  Expr *getBase() { 
-    return cast<Expr>(BaseExprOrSuperType.get<Stmt*>()); 
+  ObjCPropertyDecl *getExplicitProperty() const {
+    assert(!isImplicitProperty());
+    return cast<ObjCPropertyDecl>(PropertyOrGetter.getPointer());
   }
 
-  SourceLocation getLocation() const { return IdLoc; }
-  
-  SourceLocation getSuperLocation() const { return SuperLoc; }
-  QualType getSuperType() const { 
-    Type *t = BaseExprOrSuperType.get<Type*>();
-    return QualType(t, 0); 
+  ObjCMethodDecl *getImplicitPropertyGetter() const {
+    assert(isImplicitProperty());
+    return cast_or_null<ObjCMethodDecl>(PropertyOrGetter.getPointer());
   }
-  bool isSuperReceiver() const { return BaseExprOrSuperType.is<Type*>(); }
 
-  virtual SourceRange getSourceRange() const {
-    return SourceRange(
-                  (BaseExprOrSuperType.is<Stmt*>() ? getBase()->getLocStart() 
-                                                   : getSuperLocation()), 
-                  IdLoc);
+  ObjCMethodDecl *getImplicitPropertySetter() const {
+    assert(isImplicitProperty());
+    return Setter;
   }
 
-  static bool classof(const Stmt *T) {
-    return T->getStmtClass() == ObjCPropertyRefExprClass;
+  Selector getGetterSelector() const {
+    if (isImplicitProperty())
+      return getImplicitPropertyGetter()->getSelector();
+    return getExplicitProperty()->getGetterName();
   }
-  static bool classof(const ObjCPropertyRefExpr *) { return true; }
 
-  // Iterators
-  virtual child_iterator child_begin();
-  virtual child_iterator child_end();
-private:
-  friend class ASTStmtReader;
-  void setProperty(ObjCPropertyDecl *D) { AsProperty = D; }
-  void setBase(Expr *base) { BaseExprOrSuperType = base; }
-  void setLocation(SourceLocation L) { IdLoc = L; }
-  void setSuperLocation(SourceLocation Loc) { SuperLoc = Loc; }
-  void setSuperType(QualType T) { BaseExprOrSuperType = T.getTypePtr(); }
-};
-
-/// ObjCImplicitSetterGetterRefExpr - 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 ObjCImplicitSetterGetterRefExpr AST
-/// }
-/// @endcode
-class ObjCImplicitSetterGetterRefExpr : 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;
-  /// Location of the member in the dot syntax notation. This is location
-  /// of the getter method.
-  SourceLocation MemberLoc;
-  // FIXME: Swizzle these into a single pointer.
-  Stmt *Base;
-  ObjCInterfaceDecl *InterfaceDecl;
-  /// \brief Location of the receiver class in the dot syntax notation
-  /// used to call a class method setter/getter.
-  SourceLocation ClassLoc;
+  Selector getSetterSelector() const {
+    if (isImplicitProperty())
+      return getImplicitPropertySetter()->getSelector();
+    return getExplicitProperty()->getSetterName();
+  }
 
-  /// \brief When the receiver in dot-syntax expression is 'super',
-  /// this is the location of the 'super' keyword.
-  SourceLocation SuperLoc;
-  
-  /// \brief When the receiver in dot-syntax expression is 'super', this is
-  /// the type associated with 'super' keyword.
-  QualType SuperTy;
-  
-public:
-  ObjCImplicitSetterGetterRefExpr(ObjCMethodDecl *getter, QualType t,
-                                  ExprValueKind VK, ExprObjectKind OK,
-                                  ObjCMethodDecl *setter,
-                                  SourceLocation l, Expr *base)
-    : Expr(ObjCImplicitSetterGetterRefExprClass, t, VK, OK,
-           /*TypeDependent=*/false, base->isValueDependent()),
-      Setter(setter), Getter(getter), MemberLoc(l), Base(base),
-      InterfaceDecl(0), ClassLoc(SourceLocation()) {}
-  
-  ObjCImplicitSetterGetterRefExpr(ObjCMethodDecl *getter, QualType t,
-                                  ExprValueKind VK, ExprObjectKind OK,
-                                  ObjCMethodDecl *setter,
-                                  SourceLocation l,
-                                  SourceLocation sl, 
-                                  QualType st)
-  : Expr(ObjCImplicitSetterGetterRefExprClass, t, VK, OK,
-         /*TypeDependent=*/false, false),
-    Setter(setter), Getter(getter), MemberLoc(l),
-    Base(0), InterfaceDecl(0), ClassLoc(SourceLocation()), 
-    SuperLoc(sl), SuperTy(st) {
+  const Expr *getBase() const { 
+    return cast<Expr>(Receiver.get<Stmt*>()); 
   }
+  Expr *getBase() { 
+    return cast<Expr>(Receiver.get<Stmt*>()); 
+  }
+
+  SourceLocation getLocation() const { return IdLoc; }
   
-  ObjCImplicitSetterGetterRefExpr(ObjCMethodDecl *getter, QualType t,
-                                  ExprValueKind VK, ExprObjectKind OK,
-                                  ObjCMethodDecl *setter,
-                 SourceLocation l, ObjCInterfaceDecl *C, SourceLocation CL)
-    : Expr(ObjCImplicitSetterGetterRefExprClass, t, VK, OK, false, false),
-      Setter(setter), Getter(getter), MemberLoc(l), Base(0), InterfaceDecl(C),
-      ClassLoc(CL) {}
-  explicit ObjCImplicitSetterGetterRefExpr(EmptyShell Empty)
-           : Expr(ObjCImplicitSetterGetterRefExprClass, Empty){}
-
-  ObjCMethodDecl *getGetterMethod() const { return Getter; }
-  ObjCMethodDecl *getSetterMethod() const { return Setter; }
-  ObjCInterfaceDecl *getInterfaceDecl() const { return InterfaceDecl; }
-  void setGetterMethod(ObjCMethodDecl *D) { Getter = D; }
-  void setSetterMethod(ObjCMethodDecl *D) { Setter = D; }
-  void setInterfaceDecl(ObjCInterfaceDecl *D) { InterfaceDecl = D; }
+  SourceLocation getReceiverLocation() const { return ReceiverLoc; }
+  QualType getSuperReceiverType() const { 
+    return QualType(Receiver.get<Type*>(), 0); 
+  }
+  ObjCInterfaceDecl *getClassReceiver() const {
+    return Receiver.get<ObjCInterfaceDecl*>();
+  }
+  bool isObjectReceiver() const { return Receiver.is<Stmt*>(); }
+  bool isSuperReceiver() const { return Receiver.is<Type*>(); }
+  bool isClassReceiver() const { return Receiver.is<ObjCInterfaceDecl*>(); }
 
   virtual SourceRange getSourceRange() const {
-    if (isSuperReceiver())
-      return SourceRange(getSuperLocation(), MemberLoc);
-    if (Base)
-      return SourceRange(getBase()->getLocStart(), MemberLoc);
-    return SourceRange(ClassLoc, MemberLoc);
-  }
-  const Expr *getBase() const { return cast_or_null<Expr>(Base); }
-  Expr *getBase() { return cast_or_null<Expr>(Base); }
-  void setBase(Expr *base) { Base = base; }
-
-  SourceLocation getLocation() const { return MemberLoc; }
-  void setLocation(SourceLocation L) { MemberLoc = L; }
-  SourceLocation getClassLoc() const { return ClassLoc; }
-  void setClassLoc(SourceLocation L) { ClassLoc = L; }
-  
-  SourceLocation getSuperLocation() const { return SuperLoc; }
-  QualType getSuperType() const { return SuperTy; }
-  /// \brief When the receiver in dot-syntax expression is 'super', this
-  /// method returns true if both Base expression and Interface are null.
-  bool isSuperReceiver() const { return InterfaceDecl == 0 && Base == 0; }
+    return SourceRange((isObjectReceiver() ? getBase()->getLocStart()
+                                           : getReceiverLocation()), 
+                       IdLoc);
+  }
 
   static bool classof(const Stmt *T) {
-    return T->getStmtClass() == ObjCImplicitSetterGetterRefExprClass;
+    return T->getStmtClass() == ObjCPropertyRefExprClass;
   }
-  static bool classof(const ObjCImplicitSetterGetterRefExpr *) { return true; }
+  static bool classof(const ObjCPropertyRefExpr *) { return true; }
 
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
-  
 private:
   friend class ASTStmtReader;
-  void setSuperLocation(SourceLocation Loc) { SuperLoc = Loc; }
-  void setSuperType(QualType T) { SuperTy = T; }
+  void setExplicitProperty(ObjCPropertyDecl *D) {
+    PropertyOrGetter.setPointer(D);
+    PropertyOrGetter.setInt(false);
+    Setter = 0;
+  }
+  void setImplicitProperty(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter) {
+    PropertyOrGetter.setPointer(Getter);
+    PropertyOrGetter.setInt(true);
+    this->Setter = Setter;
+  }
+  void setBase(Expr *Base) { Receiver = Base; }
+  void setSuperReceiver(QualType T) { Receiver = T.getTypePtr(); }
+  void setClassReceiver(ObjCInterfaceDecl *D) { Receiver = D; }
+
+  void setLocation(SourceLocation L) { IdLoc = L; }
+  void setReceiverLocation(SourceLocation Loc) { ReceiverLoc = Loc; }
 };
 
 /// \brief An expression that sends a message to the given Objective-C

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Wed Dec  1 19:19:52 2010
@@ -1778,7 +1778,6 @@
 DEF_TRAVERSE_STMT(GNUNullExpr, { })
 DEF_TRAVERSE_STMT(ImplicitValueInitExpr, { })
 DEF_TRAVERSE_STMT(ObjCEncodeExpr, { })
-DEF_TRAVERSE_STMT(ObjCImplicitSetterGetterRefExpr, { })
 DEF_TRAVERSE_STMT(ObjCIsaExpr, { })
 DEF_TRAVERSE_STMT(ObjCIvarRefExpr, { })
 DEF_TRAVERSE_STMT(ObjCMessageExpr, { })

Modified: cfe/trunk/include/clang/Basic/StmtNodes.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/StmtNodes.td (original)
+++ cfe/trunk/include/clang/Basic/StmtNodes.td Wed Dec  1 19:19:52 2010
@@ -120,7 +120,6 @@
 def ObjCProtocolExpr : DStmt<Expr>;
 def ObjCIvarRefExpr : DStmt<Expr>;
 def ObjCPropertyRefExpr : DStmt<Expr>;
-def ObjCImplicitSetterGetterRefExpr : DStmt<Expr>;
 def ObjCIsaExpr : DStmt<Expr>;
 
 // Clang Extensions.

Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Wed Dec  1 19:19:52 2010
@@ -853,7 +853,7 @@
       EXPR_OBJC_IVAR_REF_EXPR,
       /// \brief An ObjCPropertyRefExpr record.
       EXPR_OBJC_PROPERTY_REF_EXPR,
-      /// \brief An ObjCImplicitSetterGetterRefExpr record.
+      /// \brief UNUSED
       EXPR_OBJC_KVC_REF_EXPR,
       /// \brief An ObjCMessageExpr record.
       EXPR_OBJC_MESSAGE_EXPR,

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed Dec  1 19:19:52 2010
@@ -1338,21 +1338,11 @@
     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 @@
     // 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 @@
   // 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 @@
 // 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; }

Modified: cfe/trunk/lib/AST/ExprClassification.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprClassification.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprClassification.cpp (original)
+++ cfe/trunk/lib/AST/ExprClassification.cpp Wed Dec  1 19:19:52 2010
@@ -104,7 +104,6 @@
   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 @@
       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 @@
       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 @@
     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 @@
 
   // 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 @@
 
   // 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.");

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Dec  1 19:19:52 2010
@@ -2506,7 +2506,6 @@
   case Expr::ObjCProtocolExprClass:
   case Expr::ObjCIvarRefExprClass:
   case Expr::ObjCPropertyRefExprClass:
-  case Expr::ObjCImplicitSetterGetterRefExprClass:
   case Expr::ObjCIsaExprClass:
   case Expr::ShuffleVectorExprClass:
   case Expr::BlockExprClass:

Modified: cfe/trunk/lib/AST/StmtDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtDumper.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtDumper.cpp (original)
+++ cfe/trunk/lib/AST/StmtDumper.cpp Wed Dec  1 19:19:52 2010
@@ -172,8 +172,6 @@
     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::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);
-
-  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->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() << '"';
+  }
+
   if (Node->isSuperReceiver())
     OS << " super";
 }

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Wed Dec  1 19:19:52 2010
@@ -516,20 +516,10 @@
     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) {

Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Wed Dec  1 19:19:52 2010
@@ -866,22 +866,15 @@
 
 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());
   }
 }
 

Modified: cfe/trunk/lib/Checker/CheckObjCDealloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/CheckObjCDealloc.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/Checker/CheckObjCDealloc.cpp Wed Dec  1 19:19:52 2010
@@ -76,8 +76,8 @@
   if (BinaryOperator* BO = dyn_cast<BinaryOperator>(S))
     if (BO->isAssignmentOp())
       if (ObjCPropertyRefExpr* PRE =
-         dyn_cast<ObjCPropertyRefExpr>(BO->getLHS()->IgnoreParenCasts()))
-          if (PRE->getProperty() == PD)
+           dyn_cast<ObjCPropertyRefExpr>(BO->getLHS()->IgnoreParenCasts()))
+        if (PRE->isExplicitProperty() && PRE->getExplicitProperty() == PD)
             if (BO->getRHS()->isNullPointerConstant(Ctx, 
                                             Expr::NPC_ValueDependentIsNull)) {
               // This is only a 'release' if the property kind is not

Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Wed Dec  1 19:19:52 2010
@@ -852,7 +852,6 @@
     case Stmt::ObjCAtFinallyStmtClass:
     case Stmt::ObjCAtTryStmtClass:
     case Stmt::ObjCEncodeExprClass:
-    case Stmt::ObjCImplicitSetterGetterRefExprClass:
     case Stmt::ObjCIsaExprClass:
     case Stmt::ObjCPropertyRefExprClass:
     case Stmt::ObjCProtocolExprClass:
@@ -1221,7 +1220,6 @@
       return;
 
     case Stmt::ObjCPropertyRefExprClass:
-    case Stmt::ObjCImplicitSetterGetterRefExprClass:
       // 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
@@ -3410,12 +3408,6 @@
   Expr* LHS = B->getLHS()->IgnoreParens();
   Expr* RHS = B->getRHS()->IgnoreParens();
 
-  // FIXME: Add proper support for ObjCImplicitSetterGetterRefExpr.
-  if (isa<ObjCImplicitSetterGetterRefExpr>(LHS)) {
-    Visit(RHS, Pred, Dst);
-    return;
-  }
-
   if (B->isAssignmentOp())
     VisitLValue(LHS, Pred, Tmp1);
   else

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Dec  1 19:19:52 2010
@@ -131,13 +131,6 @@
     if (PE->isSuperReceiver())
       Info.NeedsObjCSelf = true;
   }
-  else if (const ObjCImplicitSetterGetterRefExpr *IE = 
-           dyn_cast<ObjCImplicitSetterGetterRefExpr>(S)) {
-    // Getter/setter uses may also cause implicit super references,
-    // which we can check for with:
-    if (IE->isSuperReceiver())
-      Info.NeedsObjCSelf = true;
-  }
   else if (isa<CXXThisExpr>(S))
     Info.CXXThisRef = cast<CXXThisExpr>(S);
 }

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Dec  1 19:19:52 2010
@@ -549,8 +549,6 @@
     return EmitObjCIvarRefLValue(cast<ObjCIvarRefExpr>(E));
   case Expr::ObjCPropertyRefExprClass:
     return EmitObjCPropertyRefLValue(cast<ObjCPropertyRefExpr>(E));
-  case Expr::ObjCImplicitSetterGetterRefExprClass:
-    return EmitObjCKVCRefLValue(cast<ObjCImplicitSetterGetterRefExpr>(E));
   case Expr::StmtExprClass:
     return EmitStmtExprLValue(cast<StmtExpr>(E));
   case Expr::UnaryOperatorClass:
@@ -1569,10 +1567,9 @@
     const PointerType *PTy =
       BaseExpr->getType()->getAs<PointerType>();
     BaseQuals = PTy->getPointeeType().getQualifiers();
-  } else if (isa<ObjCPropertyRefExpr>(BaseExpr->IgnoreParens()) ||
-             isa<ObjCImplicitSetterGetterRefExpr>(
-               BaseExpr->IgnoreParens())) {
-    RValue RV = EmitObjCPropertyGet(BaseExpr);
+  } else if (ObjCPropertyRefExpr *PRE
+               = dyn_cast<ObjCPropertyRefExpr>(BaseExpr->IgnoreParens())) {
+    RValue RV = EmitObjCPropertyGet(PRE);
     BaseValue = RV.getAggregateAddr();
     BaseQuals = BaseExpr->getType().getQualifiers();
   } else {
@@ -1796,7 +1793,7 @@
         RValue RV = 
           LV.isPropertyRef() ? EmitLoadOfPropertyRefLValue(LV, QT) 
                              : EmitLoadOfKVCRefLValue(LV, QT);
-        assert(!RV.isScalar() && "EmitCastLValue-scalar cast of property ref");
+        assert(RV.isAggregate());
         llvm::Value *V = RV.getAggregateAddr();
         return MakeAddrLValue(V, QT);
       }
@@ -2107,16 +2104,12 @@
 
 LValue
 CodeGenFunction::EmitObjCPropertyRefLValue(const ObjCPropertyRefExpr *E) {
-  // This is a special l-value that just issues sends when we load or store
-  // through it.
-  return LValue::MakePropertyRef(E, E->getType().getCVRQualifiers());
-}
+  // This is a special l-value that just issues sends when we load or
+  // store through it.
 
-LValue CodeGenFunction::EmitObjCKVCRefLValue(
-                                const ObjCImplicitSetterGetterRefExpr *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());
+  if (E->isImplicitProperty())
+    return LValue::MakeKVCRef(E, E->getType().getCVRQualifiers());
+  return LValue::MakePropertyRef(E, E->getType().getCVRQualifiers());
 }
 
 LValue CodeGenFunction::EmitStmtExprLValue(const StmtExpr *E) {

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed Dec  1 19:19:52 2010
@@ -115,7 +115,6 @@
     EmitAggLoadOfLValue(E);
   }
   void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E);
-  void VisitObjCImplicitSetterGetterRefExpr(ObjCImplicitSetterGetterRefExpr *E);
 
   void VisitConditionalOperator(const ConditionalOperator *CO);
   void VisitChooseExpr(const ChooseExpr *CE);
@@ -354,12 +353,6 @@
   EmitGCMove(E, RV);
 }
 
-void AggExprEmitter::VisitObjCImplicitSetterGetterRefExpr(
-                                   ObjCImplicitSetterGetterRefExpr *E) {
-  RValue RV = CGF.EmitObjCPropertyGet(E, getReturnValueSlot());
-  EmitGCMove(E, RV);
-}
-
 void AggExprEmitter::VisitBinComma(const BinaryOperator *E) {
   CGF.EmitAnyExpr(E->getLHS(), AggValueSlot::ignored(), true);
   Visit(E->getRHS());

Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Wed Dec  1 19:19:52 2010
@@ -113,10 +113,6 @@
   ComplexPairTy VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
     return EmitLoadOfLValue(E);
   }
-  ComplexPairTy VisitObjCImplicitSetterGetterRefExpr(
-                               ObjCImplicitSetterGetterRefExpr *E) {
-    return EmitLoadOfLValue(E);
-  }
   ComplexPairTy VisitObjCMessageExpr(ObjCMessageExpr *E) {
     return CGF.EmitObjCMessageExpr(E).getComplexVal();
   }

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Dec  1 19:19:52 2010
@@ -239,10 +239,6 @@
   Value *VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
     return EmitLoadOfLValue(E);
   }
-  Value *VisitObjCImplicitSetterGetterRefExpr(
-                        ObjCImplicitSetterGetterRefExpr *E) {
-    return EmitLoadOfLValue(E);
-  }
   Value *VisitObjCMessageExpr(ObjCMessageExpr *E) {
     return CGF.EmitObjCMessageExpr(E).getScalarVal();
   }

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Wed Dec  1 19:19:52 2010
@@ -528,36 +528,34 @@
 
 }
 
-RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp,
+RValue CodeGenFunction::EmitObjCPropertyGet(const ObjCPropertyRefExpr *E,
                                             ReturnValueSlot Return) {
-  Exp = Exp->IgnoreParens();
-  // FIXME: Split it into two separate routines.
-  if (const ObjCPropertyRefExpr *E = dyn_cast<ObjCPropertyRefExpr>(Exp)) {
-    Selector S = E->getProperty()->getGetterName();
-    if (E->isSuperReceiver())
-      return EmitObjCSuperPropertyGet(E, S, Return);
-    return CGM.getObjCRuntime().
-             GenerateMessageSend(*this, Return, Exp->getType(), S,
-                                 EmitScalarExpr(E->getBase()),
-                                 CallArgList());
+  QualType ResultType;
+  Selector S;
+  if (E->isExplicitProperty()) {
+    const ObjCPropertyDecl *Property = E->getExplicitProperty();
+    S = Property->getGetterName();
+    ResultType = E->getType();
   } else {
-    const ObjCImplicitSetterGetterRefExpr *KE =
-      cast<ObjCImplicitSetterGetterRefExpr>(Exp);
-    Selector S = KE->getGetterMethod()->getSelector();
-    llvm::Value *Receiver;
-    if (KE->getInterfaceDecl()) {
-      const ObjCInterfaceDecl *OID = KE->getInterfaceDecl();
-      Receiver = CGM.getObjCRuntime().GetClass(Builder, OID);
-    } else if (KE->isSuperReceiver())
-      return EmitObjCSuperPropertyGet(KE, S, Return);
-    else
-      Receiver = EmitScalarExpr(KE->getBase());
-    return CGM.getObjCRuntime().
-             GenerateMessageSend(*this, Return, 
-                                 KE->getGetterMethod()->getResultType(), S,
-                                 Receiver,
-                                 CallArgList(), KE->getInterfaceDecl());
+    const ObjCMethodDecl *Getter = E->getImplicitPropertyGetter();
+    S = Getter->getSelector();
+    ResultType = Getter->getResultType(); // with reference!
   }
+
+  if (E->isSuperReceiver())
+    return EmitObjCSuperPropertyGet(E, S, Return);
+
+  llvm::Value *Receiver;
+  const ObjCInterfaceDecl *ReceiverClass = 0;
+  if (E->isClassReceiver()) {
+    ReceiverClass = E->getClassReceiver();
+    Receiver = CGM.getObjCRuntime().GetClass(Builder, ReceiverClass);
+  } else {
+    Receiver = EmitScalarExpr(E->getBase());
+  }
+  return CGM.getObjCRuntime().
+             GenerateMessageSend(*this, Return, ResultType, S,
+                                 Receiver, CallArgList(), ReceiverClass);
 }
 
 void CodeGenFunction::EmitObjCSuperPropertySet(const Expr *Exp,
@@ -581,43 +579,37 @@
   return;
 }
 
-void CodeGenFunction::EmitObjCPropertySet(const Expr *Exp,
+void CodeGenFunction::EmitObjCPropertySet(const ObjCPropertyRefExpr *E,
                                           RValue Src) {
-  // FIXME: Split it into two separate routines.
-  if (const ObjCPropertyRefExpr *E = dyn_cast<ObjCPropertyRefExpr>(Exp)) {
-    Selector S = E->getProperty()->getSetterName();
-    if (E->isSuperReceiver()) {
-      EmitObjCSuperPropertySet(E, S, Src);
-      return;
-    }
-    CallArgList Args;
-    Args.push_back(std::make_pair(Src, E->getType()));
-    CGM.getObjCRuntime().GenerateMessageSend(*this, ReturnValueSlot(),
-                                             getContext().VoidTy, S,
-                                             EmitScalarExpr(E->getBase()),
-                                             Args);
-  } else if (const ObjCImplicitSetterGetterRefExpr *E =
-               dyn_cast<ObjCImplicitSetterGetterRefExpr>(Exp)) {
-    const ObjCMethodDecl *SetterMD = E->getSetterMethod();
-    Selector S = SetterMD->getSelector();
-    CallArgList Args;
-    llvm::Value *Receiver;
-    if (E->getInterfaceDecl()) {
-      const ObjCInterfaceDecl *OID = E->getInterfaceDecl();
-      Receiver = CGM.getObjCRuntime().GetClass(Builder, OID);
-    } else if (E->isSuperReceiver()) {
-      EmitObjCSuperPropertySet(E, S, Src);
-      return;
-    } else
-      Receiver = EmitScalarExpr(E->getBase());
-    ObjCMethodDecl::param_iterator P = SetterMD->param_begin(); 
-    Args.push_back(std::make_pair(Src, (*P)->getType()));
-    CGM.getObjCRuntime().GenerateMessageSend(*this, ReturnValueSlot(),
-                                             getContext().VoidTy, S,
-                                             Receiver,
-                                             Args, E->getInterfaceDecl());
-  } else
-    assert (0 && "bad expression node in EmitObjCPropertySet");
+  Selector S = E->getSetterSelector();
+  QualType ArgType;
+  if (E->isImplicitProperty()) {
+    const ObjCMethodDecl *Setter = E->getImplicitPropertySetter();
+    ObjCMethodDecl::param_iterator P = Setter->param_begin(); 
+    ArgType = (*P)->getType();
+  } else {
+    ArgType = E->getType();
+  }
+
+  if (E->isSuperReceiver()) {
+    EmitObjCSuperPropertySet(E, S, Src);
+    return;
+  }
+
+  const ObjCInterfaceDecl *ReceiverClass = 0;
+  llvm::Value *Receiver;
+  if (E->isClassReceiver()) {
+    ReceiverClass = E->getClassReceiver();
+    Receiver = CGM.getObjCRuntime().GetClass(Builder, ReceiverClass);
+  } else {
+    Receiver = EmitScalarExpr(E->getBase());
+  }
+
+  CallArgList Args;
+  Args.push_back(std::make_pair(Src, ArgType));
+  CGM.getObjCRuntime().GenerateMessageSend(*this, ReturnValueSlot(),
+                                           getContext().VoidTy, S,
+                                           Receiver, Args, ReceiverClass);
 }
 
 void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){

Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Wed Dec  1 19:19:52 2010
@@ -25,7 +25,6 @@
 
 namespace clang {
   class ObjCPropertyRefExpr;
-  class ObjCImplicitSetterGetterRefExpr;
 
 namespace CodeGen {
   class CGBitFieldInfo;
@@ -129,9 +128,6 @@
 
     // Obj-C property reference expression
     const ObjCPropertyRefExpr *PropertyRefExpr;
-
-    // ObjC 'implicit' property reference expression
-    const ObjCImplicitSetterGetterRefExpr *KVCRefExpr;
   };
 
   // 'const' is unused here
@@ -255,9 +251,9 @@
   }
 
   // 'implicit' property ref lvalue
-  const ObjCImplicitSetterGetterRefExpr *getKVCRefExpr() const {
+  const ObjCPropertyRefExpr *getKVCRefExpr() const {
     assert(isKVCRef());
-    return KVCRefExpr;
+    return PropertyRefExpr;
   }
 
   static LValue MakeAddr(llvm::Value *V, QualType T, unsigned Alignment,
@@ -321,11 +317,11 @@
     return R;
   }
 
-  static LValue MakeKVCRef(const ObjCImplicitSetterGetterRefExpr *E,
+  static LValue MakeKVCRef(const ObjCPropertyRefExpr *E,
                            unsigned CVR) {
     LValue R;
     R.LVType = KVCRef;
-    R.KVCRefExpr = E;
+    R.PropertyRefExpr = E;
     R.Initialize(Qualifiers::fromCVRMask(CVR));
     return R;
   }

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Dec  1 19:19:52 2010
@@ -1460,7 +1460,6 @@
   LValue EmitObjCMessageExprLValue(const ObjCMessageExpr *E);
   LValue EmitObjCIvarRefLValue(const ObjCIvarRefExpr *E);
   LValue EmitObjCPropertyRefLValue(const ObjCPropertyRefExpr *E);
-  LValue EmitObjCKVCRefLValue(const ObjCImplicitSetterGetterRefExpr *E);
   LValue EmitStmtExprLValue(const StmtExpr *E);
   LValue EmitPointerToDataMemberBinaryExpr(const BinaryOperator *E);
   LValue EmitObjCSelectorLValue(const ObjCSelectorExpr *E);
@@ -1545,11 +1544,11 @@
   llvm::Value *EmitObjCSelectorExpr(const ObjCSelectorExpr *E);
   RValue EmitObjCMessageExpr(const ObjCMessageExpr *E,
                              ReturnValueSlot Return = ReturnValueSlot());
-  RValue EmitObjCPropertyGet(const Expr *E,
+  RValue EmitObjCPropertyGet(const ObjCPropertyRefExpr *E,
                              ReturnValueSlot Return = ReturnValueSlot());
   RValue EmitObjCSuperPropertyGet(const Expr *Exp, const Selector &S,
                                   ReturnValueSlot Return = ReturnValueSlot());
-  void EmitObjCPropertySet(const Expr *E, RValue Src);
+  void EmitObjCPropertySet(const ObjCPropertyRefExpr *E, RValue Src);
   void EmitObjCSuperPropertySet(const Expr *E, const Selector &S, RValue Src);
 
 

Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Dec  1 19:19:52 2010
@@ -1651,7 +1651,6 @@
   case Expr::CompoundLiteralExprClass:
   case Expr::ExtVectorElementExprClass:
   case Expr::ObjCEncodeExprClass:
-  case Expr::ObjCImplicitSetterGetterRefExprClass:
   case Expr::ObjCIsaExprClass:
   case Expr::ObjCIvarRefExprClass:
   case Expr::ObjCMessageExprClass:

Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Wed Dec  1 19:19:52 2010
@@ -1230,30 +1230,24 @@
   SourceLocation SuperLocation;
   // Synthesize a ObjCMessageExpr from a ObjCPropertyRefExpr or ObjCImplicitSetterGetterRefExpr.
   // This allows us to reuse all the fun and games in SynthMessageExpr().
-  if (ObjCPropertyRefExpr *PropRefExpr = dyn_cast<ObjCPropertyRefExpr>(BinOp->getLHS())) {
-    ObjCPropertyDecl *PDecl = PropRefExpr->getProperty();
-    OMD = PDecl->getSetterMethodDecl();
-    Ty = PDecl->getType();
-    Sel = PDecl->getSetterName();
+  if (ObjCPropertyRefExpr *PropRefExpr =
+        dyn_cast<ObjCPropertyRefExpr>(BinOp->getLHS())) {
+    if (PropRefExpr->isExplicitProperty()) {
+      ObjCPropertyDecl *PDecl = PropRefExpr->getExplicitProperty();
+      OMD = PDecl->getSetterMethodDecl();
+      Ty = PDecl->getType();
+      Sel = PDecl->getSetterName();
+    } else {
+      OMD = PropRefExpr->getImplicitPropertySetter();
+      Sel = OMD->getSelector();
+      Ty = PropRefExpr->getType();
+    }
     Super = PropRefExpr->isSuperReceiver();
-    if (!Super)
+    if (!Super) {
       Receiver = PropRefExpr->getBase();
-    else {
-      SuperTy = PropRefExpr->getSuperType();
-      SuperLocation = PropRefExpr->getSuperLocation();
-    }
-  }
-  else if (ObjCImplicitSetterGetterRefExpr *ImplicitRefExpr = 
-           dyn_cast<ObjCImplicitSetterGetterRefExpr>(BinOp->getLHS())) {
-    OMD = ImplicitRefExpr->getSetterMethod();
-    Sel = OMD->getSelector();
-    Ty = ImplicitRefExpr->getType();
-    Super = ImplicitRefExpr->isSuperReceiver();
-    if (!Super)
-      Receiver = ImplicitRefExpr->getBase();
-    else {
-      SuperTy = ImplicitRefExpr->getSuperType();
-      SuperLocation = ImplicitRefExpr->getSuperLocation();
+    } else {
+      SuperTy = PropRefExpr->getSuperReceiverType();
+      SuperLocation = PropRefExpr->getReceiverLocation();
     }
   }
   
@@ -1314,29 +1308,22 @@
   SourceLocation SuperLocation;
   if (ObjCPropertyRefExpr *PropRefExpr = 
         dyn_cast<ObjCPropertyRefExpr>(PropOrGetterRefExpr)) {
-    ObjCPropertyDecl *PDecl = PropRefExpr->getProperty();
-    OMD = PDecl->getGetterMethodDecl();
-    Ty = PDecl->getType();
-    Sel = PDecl->getGetterName();
+    if (PropRefExpr->isExplicitProperty()) {
+      ObjCPropertyDecl *PDecl = PropRefExpr->getExplicitProperty();
+      OMD = PDecl->getGetterMethodDecl();
+      Ty = PDecl->getType();
+      Sel = PDecl->getGetterName();
+    } else {
+      OMD = PropRefExpr->getImplicitPropertyGetter();
+      Sel = OMD->getSelector();
+      Ty = PropRefExpr->getType();
+    }
     Super = PropRefExpr->isSuperReceiver();
     if (!Super)
       Receiver = PropRefExpr->getBase();
     else {
-      SuperTy = PropRefExpr->getSuperType();
-      SuperLocation = PropRefExpr->getSuperLocation();
-    }
-  }
-  else if (ObjCImplicitSetterGetterRefExpr *ImplicitRefExpr = 
-            dyn_cast<ObjCImplicitSetterGetterRefExpr>(PropOrGetterRefExpr)) {
-    OMD = ImplicitRefExpr->getGetterMethod();
-    Sel = OMD->getSelector();
-    Ty = ImplicitRefExpr->getType();
-    Super = ImplicitRefExpr->isSuperReceiver();
-    if (!Super)
-      Receiver = ImplicitRefExpr->getBase();
-    else {
-      SuperTy = ImplicitRefExpr->getSuperType();
-      SuperLocation = ImplicitRefExpr->getSuperLocation();
+      SuperTy = PropRefExpr->getSuperReceiverType();
+      SuperLocation = PropRefExpr->getReceiverLocation();
     }
   }
   
@@ -1376,8 +1363,7 @@
     PropParentMap = new ParentMap(CurrentBody);
 
   Stmt *Parent = PropParentMap->getParent(PropOrGetterRefExpr);
-  if (Parent && (isa<ObjCPropertyRefExpr>(Parent) ||
-                 isa<ObjCImplicitSetterGetterRefExpr>(Parent))) {
+  if (Parent && isa<ObjCPropertyRefExpr>(Parent)) {
     // We stash away the ReplacingStmt since actually doing the
     // replacement/rewrite won't work for nested getters (e.g. obj.p.i)
     PropGetters[PropOrGetterRefExpr] = ReplacingStmt;
@@ -5495,9 +5481,8 @@
 
   if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
     if (BinOp->isAssignmentOp()) {
-        if (isa<ObjCPropertyRefExpr>(BinOp->getLHS()) || 
-            isa<ObjCImplicitSetterGetterRefExpr>(BinOp->getLHS()))
-          PropSetters[BinOp->getLHS()] = BinOp;
+      if (isa<ObjCPropertyRefExpr>(BinOp->getLHS()))
+        PropSetters[BinOp->getLHS()] = BinOp;
     }
   }
 }
@@ -5539,8 +5524,7 @@
       // setter messaging. This involvs the RHS too. Do not attempt to rewrite
       // RHS again.
       if (Expr *Exp = dyn_cast<Expr>(S))
-        if (isa<ObjCPropertyRefExpr>(Exp) || 
-            isa<ObjCImplicitSetterGetterRefExpr>(Exp)) {
+        if (isa<ObjCPropertyRefExpr>(Exp)) {
           if (PropSetters[Exp]) {
             ++CI;
             continue;
@@ -5577,7 +5561,7 @@
   if (ObjCEncodeExpr *AtEncode = dyn_cast<ObjCEncodeExpr>(S))
     return RewriteAtEncode(AtEncode);
 
-  if (isa<ObjCPropertyRefExpr>(S) || isa<ObjCImplicitSetterGetterRefExpr>(S)) {
+  if (isa<ObjCPropertyRefExpr>(S)) {
     Expr *PropOrImplicitRefExpr = dyn_cast<Expr>(S);
     assert(PropOrImplicitRefExpr && "Property or implicit setter/getter is null");
     

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Dec  1 19:19:52 2010
@@ -3538,9 +3538,9 @@
         ExprObjectKind OK = (VK == VK_RValue ? OK_Ordinary : OK_ObjCProperty);
 
         // FIXME: we must check that the setter has property type.
-        return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(Getter,
-                                                  PType, VK, OK,
-                                                  Setter, MemberLoc, BaseExpr));
+        return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
+                                                       PType, VK, OK,
+                                                       MemberLoc, BaseExpr));
       }
       return ExprError(Diag(MemberLoc, diag::err_property_not_found)
                        << MemberName << BaseType);
@@ -3726,10 +3726,8 @@
           VK = VK_RValue;
         ExprObjectKind OK = (VK == VK_RValue ? OK_Ordinary : OK_ObjCProperty);
 
-        return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(OMD, PType,
-                                                                   VK, OK, SMD,
-                                                                   MemberLoc, 
-                                                                   BaseExpr));
+        return Owned(new (Context) ObjCPropertyRefExpr(OMD, SMD, PType, VK, OK,
+                                                       MemberLoc, BaseExpr));
       }
     }
 
@@ -6683,17 +6681,18 @@
 static bool IsReadonlyProperty(Expr *E, Sema &S) {
   if (E->getStmtClass() == Expr::ObjCPropertyRefExprClass) {
     const ObjCPropertyRefExpr* PropExpr = cast<ObjCPropertyRefExpr>(E);
-    if (ObjCPropertyDecl *PDecl = PropExpr->getProperty()) {
-      QualType BaseType = PropExpr->isSuperReceiver() ? 
-                            PropExpr->getSuperType() :  
+    if (PropExpr->isImplicitProperty()) return false;
+
+    ObjCPropertyDecl *PDecl = PropExpr->getExplicitProperty();
+    QualType BaseType = PropExpr->isSuperReceiver() ? 
+                            PropExpr->getSuperReceiverType() :  
                             PropExpr->getBase()->getType();
       
-      if (const ObjCObjectPointerType *OPT =
-            BaseType->getAsObjCInterfacePointerType())
-        if (ObjCInterfaceDecl *IFace = OPT->getInterfaceDecl())
-          if (S.isPropertyReadonly(PDecl, IFace))
-            return true;
-    }
+    if (const ObjCObjectPointerType *OPT =
+          BaseType->getAsObjCInterfacePointerType())
+      if (ObjCInterfaceDecl *IFace = OPT->getInterfaceDecl())
+        if (S.isPropertyReadonly(PDecl, IFace))
+          return true;
   }
   return false;
 }
@@ -6970,20 +6969,18 @@
 
 void Sema::ConvertPropertyAssignment(Expr *LHS, Expr *&RHS, QualType& LHSTy) {
   bool copyInit = false;
-  if (const ObjCImplicitSetterGetterRefExpr *OISGE = 
-      dyn_cast<ObjCImplicitSetterGetterRefExpr>(LHS)) {
-    // If using property-dot syntax notation for assignment, and there is a
-    // setter, RHS expression is being passed to the setter argument. So,
-    // type conversion (and comparison) is RHS to setter's argument type.
-    if (const ObjCMethodDecl *SetterMD = OISGE->getSetterMethod()) {
-      ObjCMethodDecl::param_iterator P = SetterMD->param_begin();
-      LHSTy = (*P)->getType();
+  if (const ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(LHS)) {
+    if (PRE->isImplicitProperty()) {
+      // If using property-dot syntax notation for assignment, and there is a
+      // setter, RHS expression is being passed to the setter argument. So,
+      // type conversion (and comparison) is RHS to setter's argument type.
+      if (const ObjCMethodDecl *SetterMD = PRE->getImplicitPropertySetter()) {
+        ObjCMethodDecl::param_iterator P = SetterMD->param_begin();
+        LHSTy = (*P)->getType();
+      }
     }
     copyInit = (getLangOptions().CPlusPlus && LHSTy->isRecordType());
   } 
-  else 
-      copyInit = (getLangOptions().CPlusPlus && isa<ObjCPropertyRefExpr>(LHS) &&
-                  LHSTy->isRecordType());
   if (copyInit) {
     InitializedEntity Entity = 
     InitializedEntity::InitializeParameter(Context, LHSTy);
@@ -7614,9 +7611,8 @@
                             BinaryOperatorKind Opc,
                             Expr *lhs, Expr *rhs) {
   if (getLangOptions().CPlusPlus &&
-      ((!isa<ObjCImplicitSetterGetterRefExpr>(lhs) && 
-        !isa<ObjCPropertyRefExpr>(lhs))
-        || rhs->isTypeDependent() || Opc != BO_Assign) &&
+      (!isa<ObjCPropertyRefExpr>(lhs)
+       || rhs->isTypeDependent() || Opc != BO_Assign) &&
       (lhs->getType()->isOverloadableType() ||
        rhs->getType()->isOverloadableType())) {
     // Find all of the overloaded operators visible from this

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Wed Dec  1 19:19:52 2010
@@ -439,12 +439,14 @@
       VK = VK_RValue, OK = OK_Ordinary;
 
     if (Super)
-      return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(Getter, PType,
-                                    VK, OK, Setter, MemberLoc,
-                                    SuperLoc, SuperType));
+      return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
+                                                     PType, VK, OK,
+                                                     MemberLoc,
+                                                     SuperLoc, SuperType));
     else
-      return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(Getter, PType,
-                                    VK, OK, Setter, MemberLoc, BaseExpr));
+      return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
+                                                     PType, VK, OK,
+                                                     MemberLoc, BaseExpr));
 
   }
 
@@ -566,9 +568,10 @@
 
     ExprObjectKind OK = (VK == VK_RValue ? OK_Ordinary : OK_ObjCProperty);
 
-    return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(
-                                  Getter, PType, VK, OK, Setter,
-                                  propertyNameLoc, IFace, receiverNameLoc));
+    return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
+                                                   PType, VK, OK,
+                                                   propertyNameLoc,
+                                                   receiverNameLoc, IFace));
   }
   return ExprError(Diag(propertyNameLoc, diag::err_property_not_found)
                      << &propertyName << Context.getObjCInterfaceType(IFace));

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Wed Dec  1 19:19:52 2010
@@ -89,13 +89,10 @@
   // we might want to make a more specific diagnostic.  Check for one of these
   // cases now.
   unsigned DiagID = diag::warn_unused_expr;
-  E = E->IgnoreParens();
-  if (isa<ObjCImplicitSetterGetterRefExpr>(E))
-    DiagID = diag::warn_unused_property_expr;
-  
   if (const CXXExprWithTemporaries *Temps = dyn_cast<CXXExprWithTemporaries>(E))
     E = Temps->getSubExpr();
-      
+
+  E = E->IgnoreParens();
   if (const CallExpr *CE = dyn_cast<CallExpr>(E)) {
     if (E->getType()->isVoidType())
       return;
@@ -116,13 +113,14 @@
         return;
       }
     }        
-  }
-  else if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(E)) {
+  } else if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(E)) {
     const ObjCMethodDecl *MD = ME->getMethodDecl();
     if (MD && MD->getAttr<WarnUnusedResultAttr>()) {
       Diag(Loc, diag::warn_unused_call) << R1 << R2 << "warn_unused_result";
       return;
     }
+  } else if (isa<ObjCPropertyRefExpr>(E)) {
+    DiagID = diag::warn_unused_property_expr;
   } else if (const CXXFunctionalCastExpr *FC
                                        = dyn_cast<CXXFunctionalCastExpr>(E)) {
     if (isa<CXXConstructExpr>(FC->getSubExpr()) ||

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Wed Dec  1 19:19:52 2010
@@ -1891,39 +1891,20 @@
                                               /*TemplateArgs=*/0);
   }
   
-  /// \brief Build a new Objective-C implicit setter/getter reference 
-  /// expression.
+  /// \brief Build a new Objective-C property reference expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
-  /// Subclasses may override this routine to provide different behavior.  
-  ExprResult RebuildObjCImplicitSetterGetterRefExpr(
-                                                        ObjCMethodDecl *Getter,
-                                                        QualType T,
-                                                        ObjCMethodDecl *Setter,
-                                                        SourceLocation NameLoc,
-                                                        Expr *Base,
-                                                        SourceLocation SuperLoc,
-                                                        QualType SuperTy, 
-                                                        bool Super) {
-    // Since these expressions can only be value-dependent, we do not need to
-    // perform semantic analysis again.
-    if (Super)
-      return Owned(
-        new (getSema().Context) ObjCImplicitSetterGetterRefExpr(Getter, T,
-                                                                VK_LValue,
-                                                                OK_Ordinary,
-                                                                Setter,
-                                                                NameLoc,
-                                                                SuperLoc,
-                                                                SuperTy));
-    else
-      return Owned(
-        new (getSema().Context) ObjCImplicitSetterGetterRefExpr(Getter, T,
-                                                                VK_LValue,
-                                                                OK_Ordinary,
-                                                                Setter,
-                                                                NameLoc,
-                                                                Base));
+  /// Subclasses may override this routine to provide different behavior.
+  ExprResult RebuildObjCPropertyRefExpr(Expr *Base, QualType T,
+                                        ObjCMethodDecl *Getter,
+                                        ObjCMethodDecl *Setter,
+                                        SourceLocation PropertyLoc) {
+    // Since these expressions can only be value-dependent, we do not
+    // need to perform semantic analysis again.
+    return Owned(
+      new (getSema().Context) ObjCPropertyRefExpr(Getter, Setter, T,
+                                                  VK_LValue, OK_ObjCProperty,
+                                                  PropertyLoc, Base));
   }
 
   /// \brief Build a new Objective-C "isa" expression.
@@ -6222,9 +6203,9 @@
 template<typename Derived>
 ExprResult
 TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
-  // 'super' never changes. Property never changes. Just retain the existing
-  // expression.
-  if (E->isSuperReceiver())
+  // 'super' and types never change. Property never changes. Just
+  // retain the existing expression.
+  if (!E->isObjectReceiver())
     return SemaRef.Owned(E);
   
   // Transform the base expression.
@@ -6238,47 +6219,17 @@
   if (!getDerived().AlwaysRebuild() &&
       Base.get() == E->getBase())
     return SemaRef.Owned(E);
-  
-  return getDerived().RebuildObjCPropertyRefExpr(Base.get(), E->getProperty(),
-                                                 E->getLocation());
-}
 
-template<typename Derived>
-ExprResult
-TreeTransform<Derived>::TransformObjCImplicitSetterGetterRefExpr(
-                                          ObjCImplicitSetterGetterRefExpr *E) {
-  // If this implicit setter/getter refers to super, it cannot have any
-  // dependent parts. Just retain the existing declaration.
-  if (E->isSuperReceiver())
-    return SemaRef.Owned(E);
-  
-  // If this implicit setter/getter refers to class methods, it cannot have any
-  // dependent parts. Just retain the existing declaration.
-  if (E->getInterfaceDecl())
-    return SemaRef.Owned(E);
-  
-  // Transform the base expression.
-  ExprResult Base = getDerived().TransformExpr(E->getBase());
-  if (Base.isInvalid())
-    return ExprError();
-  
-  // We don't need to transform the getters/setters; they will never change.
-  
-  // If nothing changed, just retain the existing expression.
-  if (!getDerived().AlwaysRebuild() &&
-      Base.get() == E->getBase())
-    return SemaRef.Owned(E);
-  
-  return getDerived().RebuildObjCImplicitSetterGetterRefExpr(
-                                                          E->getGetterMethod(),
-                                                          E->getType(),
-                                                          E->getSetterMethod(),
-                                                          E->getLocation(),
-                                                          Base.get(),
-                                                          E->getSuperLocation(), 
-                                                          E->getSuperType(),
-                                                          E->isSuperReceiver());
-                                                             
+  if (E->isExplicitProperty())
+    return getDerived().RebuildObjCPropertyRefExpr(Base.get(),
+                                                   E->getExplicitProperty(),
+                                                   E->getLocation());
+
+  return getDerived().RebuildObjCPropertyRefExpr(Base.get(),
+                                                 E->getType(),
+                                                 E->getImplicitPropertyGetter(),
+                                                 E->getImplicitPropertySetter(),
+                                                 E->getLocation());
 }
 
 template<typename Derived>

Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Wed Dec  1 19:19:52 2010
@@ -127,8 +127,6 @@
     void VisitObjCProtocolExpr(ObjCProtocolExpr *E);
     void VisitObjCIvarRefExpr(ObjCIvarRefExpr *E);
     void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E);
-    void VisitObjCImplicitSetterGetterRefExpr(
-                            ObjCImplicitSetterGetterRefExpr *E);
     void VisitObjCMessageExpr(ObjCMessageExpr *E);
     void VisitObjCIsaExpr(ObjCIsaExpr *E);
 
@@ -849,31 +847,31 @@
 
 void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
   VisitExpr(E);
-  E->setProperty(cast<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
-  E->setLocation(ReadSourceLocation(Record, Idx));
-  E->SuperLoc = ReadSourceLocation(Record, Idx);
-  if (E->isSuperReceiver()) {
-    QualType T = Reader.GetType(Record[Idx++]);
-    E->BaseExprOrSuperType = T.getTypePtr();
+  bool Implicit = Record[Idx++] != 0;
+  if (Implicit) {
+    ObjCMethodDecl *Getter =
+      cast<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++]));
+    ObjCMethodDecl *Setter =
+      cast<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++]));
+    E->setImplicitProperty(Getter, Setter);
+  } else {
+    E->setExplicitProperty(
+                      cast<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
   }
-  else
-    E->setBase(Reader.ReadSubExpr());
-}
-
-void ASTStmtReader::VisitObjCImplicitSetterGetterRefExpr(
-                                      ObjCImplicitSetterGetterRefExpr *E) {
-  VisitExpr(E);
-  E->setGetterMethod(
-                 cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++])));
-  E->setSetterMethod(
-                 cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++])));
-  E->setInterfaceDecl(
-              cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
-  E->setBase(Reader.ReadSubExpr());
   E->setLocation(ReadSourceLocation(Record, Idx));
-  E->setClassLoc(ReadSourceLocation(Record, Idx));
-  E->SuperLoc = ReadSourceLocation(Record, Idx);
-  E->SuperTy = Reader.GetType(Record[Idx++]);
+  E->setReceiverLocation(ReadSourceLocation(Record, Idx));
+  switch (Record[Idx++]) {
+  case 0:
+    E->setBase(Reader.ReadSubExpr());
+    break;
+  case 1:
+    E->setSuperReceiver(Reader.GetType(Record[Idx++]));
+    break;
+  case 2:
+    E->setClassReceiver(
+                     cast<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
+    break;
+  }
 }
 
 void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
@@ -1639,7 +1637,7 @@
       S = new (Context) ObjCPropertyRefExpr(Empty);
       break;
     case EXPR_OBJC_KVC_REF_EXPR:
-      S = new (Context) ObjCImplicitSetterGetterRefExpr(Empty);
+      llvm_unreachable("mismatching AST file");
       break;
     case EXPR_OBJC_MESSAGE_EXPR:
       S = ObjCMessageExpr::CreateEmpty(*Context,

Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Wed Dec  1 19:19:52 2010
@@ -100,8 +100,6 @@
     void VisitObjCProtocolExpr(ObjCProtocolExpr *E);
     void VisitObjCIvarRefExpr(ObjCIvarRefExpr *E);
     void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E);
-    void VisitObjCImplicitSetterGetterRefExpr(
-                        ObjCImplicitSetterGetterRefExpr *E);
     void VisitObjCMessageExpr(ObjCMessageExpr *E);
     void VisitObjCIsaExpr(ObjCIsaExpr *E);
 
@@ -828,33 +826,29 @@
 
 void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
   VisitExpr(E);
-  Writer.AddDeclRef(E->getProperty(), Record);
+  Record.push_back(E->isImplicitProperty());
+  if (E->isImplicitProperty()) {
+    Writer.AddDeclRef(E->getImplicitPropertyGetter(), Record);
+    Writer.AddDeclRef(E->getImplicitPropertySetter(), Record);
+  } else {
+    Writer.AddDeclRef(E->getExplicitProperty(), Record);
+  }
   Writer.AddSourceLocation(E->getLocation(), Record);
-  Writer.AddSourceLocation(E->getSuperLocation(), Record);
-  if (E->isSuperReceiver())
-    Writer.AddTypeRef(E->getSuperType(), Record);
-  else
+  Writer.AddSourceLocation(E->getReceiverLocation(), Record);
+  if (E->isObjectReceiver()) {
+    Record.push_back(0);
     Writer.AddStmt(E->getBase());
+  } else if (E->isSuperReceiver()) {
+    Record.push_back(1);
+    Writer.AddTypeRef(E->getSuperReceiverType(), Record);
+  } else {
+    Record.push_back(2);
+    Writer.AddDeclRef(E->getClassReceiver(), Record);
+  }
   
   Code = serialization::EXPR_OBJC_PROPERTY_REF_EXPR;
 }
 
-void ASTStmtWriter::VisitObjCImplicitSetterGetterRefExpr(
-                                  ObjCImplicitSetterGetterRefExpr *E) {
-  VisitExpr(E);
-  Writer.AddDeclRef(E->getGetterMethod(), Record);
-  Writer.AddDeclRef(E->getSetterMethod(), Record);
-
-  // NOTE: InterfaceDecl and Base are mutually exclusive.
-  Writer.AddDeclRef(E->getInterfaceDecl(), Record);
-  Writer.AddStmt(E->getBase());
-  Writer.AddSourceLocation(E->getLocation(), Record);
-  Writer.AddSourceLocation(E->getClassLoc(), Record);
-  Writer.AddSourceLocation(E->getSuperLocation(), Record);
-  Writer.AddTypeRef(E->getSuperType(), Record);
-  Code = serialization::EXPR_OBJC_KVC_REF_EXPR;
-}
-
 void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
   VisitExpr(E);
   Record.push_back(E->getNumArgs());

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Dec  1 19:19:52 2010
@@ -2612,7 +2612,7 @@
   if (ObjCIvarRefExpr *RE = dyn_cast<ObjCIvarRefExpr>(E))
     return RE->getDecl();
   if (ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(E))
-    return PRE->getProperty();
+    return PRE->isExplicitProperty() ? PRE->getExplicitProperty() : 0;
       
   if (CallExpr *CE = dyn_cast<CallExpr>(E))
     return getDeclFromExpr(CE->getCallee());

Modified: cfe/trunk/tools/libclang/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=120643&r1=120642&r2=120643&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXCursor.cpp (original)
+++ cfe/trunk/tools/libclang/CXCursor.cpp Wed Dec  1 19:19:52 2010
@@ -160,7 +160,6 @@
   case Stmt::ObjCEncodeExprClass:       
   case Stmt::ObjCSelectorExprClass:   
   case Stmt::ObjCProtocolExprClass:   
-  case Stmt::ObjCImplicitSetterGetterRefExprClass: 
   case Stmt::ObjCIsaExprClass:       
   case Stmt::ShuffleVectorExprClass: 
   case Stmt::BlockExprClass:  
@@ -189,7 +188,6 @@
   case Stmt::CXXConstructExprClass:  
   case Stmt::CXXTemporaryObjectExprClass:
     // FIXME: CXXUnresolvedConstructExpr
-    // FIXME: ObjCImplicitSetterGetterRefExpr?
     K = CXCursor_CallExpr;
     break;
       





More information about the cfe-commits mailing list