[cfe-commits] r70100 - in /cfe/trunk: clang.xcodeproj/project.pbxproj include/clang/AST/ExprObjC.h include/clang/Frontend/PCHBitCodes.h lib/AST/Expr.cpp lib/Frontend/PCHReader.cpp lib/Frontend/PCHWriter.cpp

Chris Lattner sabre at nondot.org
Sat Apr 25 17:44:05 PDT 2009


Author: lattner
Date: Sat Apr 25 19:44:05 2009
New Revision: 70100

URL: http://llvm.org/viewvc/llvm-project?rev=70100&view=rev
Log:
implement PCH support for the rest of ExprObjC.h, including
the missing bits of ObjCMessageExpr.


Modified:
    cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/trunk/include/clang/AST/ExprObjC.h
    cfe/trunk/include/clang/Frontend/PCHBitCodes.h
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/lib/Frontend/PCHReader.cpp
    cfe/trunk/lib/Frontend/PCHWriter.cpp

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=70100&r1=70099&r2=70100&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Sat Apr 25 19:44:05 2009
@@ -202,7 +202,6 @@
 		DED7D9E50A5257F6003AD0FB /* ScratchBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DED7D9E40A5257F6003AD0FB /* ScratchBuffer.cpp */; };
 		DEDFE5CF0F7206E40035BD10 /* NestedNameSpecifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEDFE5CE0F7206E40035BD10 /* NestedNameSpecifier.cpp */; };
 		DEDFE6350F7B3B180035BD10 /* Warnings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEDFE6220F7B3B180035BD10 /* Warnings.cpp */; };
-		DEDFE6360F7B3B180035BD10 /* SerializationTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEDFE6230F7B3B180035BD10 /* SerializationTest.cpp */; };
 		DEDFE6370F7B3B180035BD10 /* RewriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEDFE6240F7B3B180035BD10 /* RewriteTest.cpp */; };
 		DEDFE6380F7B3B180035BD10 /* DependencyFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEDFE6250F7B3B180035BD10 /* DependencyFile.cpp */; };
 		DEDFE6390F7B3B180035BD10 /* HTMLPrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEDFE6260F7B3B180035BD10 /* HTMLPrint.cpp */; };
@@ -615,7 +614,6 @@
 		DEDFE5CB0F7206CC0035BD10 /* NestedNameSpecifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NestedNameSpecifier.h; path = clang/AST/NestedNameSpecifier.h; sourceTree = "<group>"; };
 		DEDFE5CE0F7206E40035BD10 /* NestedNameSpecifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NestedNameSpecifier.cpp; path = lib/AST/NestedNameSpecifier.cpp; sourceTree = "<group>"; };
 		DEDFE6220F7B3B180035BD10 /* Warnings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Warnings.cpp; path = "tools/clang-cc/Warnings.cpp"; sourceTree = "<group>"; tabWidth = 2; };
-		DEDFE6230F7B3B180035BD10 /* SerializationTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = SerializationTest.cpp; path = "tools/clang-cc/SerializationTest.cpp"; sourceTree = "<group>"; tabWidth = 2; };
 		DEDFE6240F7B3B180035BD10 /* RewriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = RewriteTest.cpp; path = "tools/clang-cc/RewriteTest.cpp"; sourceTree = "<group>"; tabWidth = 2; };
 		DEDFE6250F7B3B180035BD10 /* DependencyFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = DependencyFile.cpp; path = "tools/clang-cc/DependencyFile.cpp"; sourceTree = "<group>"; tabWidth = 2; };
 		DEDFE6260F7B3B180035BD10 /* HTMLPrint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLPrint.cpp; path = "tools/clang-cc/HTMLPrint.cpp"; sourceTree = "<group>"; tabWidth = 2; };
@@ -1324,7 +1322,6 @@
 				DEDFE6310F7B3B180035BD10 /* RewriteMacros.cpp */,
 				DEDFE62F0F7B3B180035BD10 /* RewriteObjC.cpp */,
 				DEDFE6240F7B3B180035BD10 /* RewriteTest.cpp */,
-				DEDFE6230F7B3B180035BD10 /* SerializationTest.cpp */,
 				DEDFE6220F7B3B180035BD10 /* Warnings.cpp */,
 				1AFEF4050F8A6B2300476F2B /* clang-cc.cpp */,
 				1AFEF4060F8A6B2300476F2B /* clang-cc.h */,
@@ -1625,7 +1622,6 @@
 				DEDFE5CF0F7206E40035BD10 /* NestedNameSpecifier.cpp in Sources */,
 				1ADF47AF0F782C3200E48A8A /* SemaTemplateInstantiateDecl.cpp in Sources */,
 				DEDFE6350F7B3B180035BD10 /* Warnings.cpp in Sources */,
-				DEDFE6360F7B3B180035BD10 /* SerializationTest.cpp in Sources */,
 				DEDFE6370F7B3B180035BD10 /* RewriteTest.cpp in Sources */,
 				DEDFE6380F7B3B180035BD10 /* DependencyFile.cpp in Sources */,
 				DEDFE6390F7B3B180035BD10 /* HTMLPrint.cpp in Sources */,

Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=70100&r1=70099&r2=70100&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Sat Apr 25 19:44:05 2009
@@ -181,19 +181,29 @@
     Loc(l), Base(base), IsArrow(arrow),
     IsFreeIvar(freeIvar) {}
   
+  explicit ObjCIvarRefExpr(EmptyShell Empty)
+    : Expr(ObjCIvarRefExprClass, Empty) {}
+
   ObjCIvarDecl *getDecl() { return D; }
   const ObjCIvarDecl *getDecl() const { return D; }
-  virtual SourceRange getSourceRange() const { 
-    return isFreeIvar() ? SourceRange(Loc)
-                        : SourceRange(getBase()->getLocStart(), Loc); 
-  }
+  void setDecl(ObjCIvarDecl *d) { D = d; }
+  
   const Expr *getBase() const { return cast<Expr>(Base); }
   Expr *getBase() { return cast<Expr>(Base); }
   void setBase(Expr * base) { Base = base; }
+  
   bool isArrow() const { return IsArrow; }
   bool isFreeIvar() const { return IsFreeIvar; }
+  void setIsArrow(bool A) { IsArrow = A; }
+  void setIsFreeIvar(bool A) { IsFreeIvar = A; }
   
   SourceLocation getLocation() const { return Loc; }
+  void setLocation(SourceLocation L) { Loc = L; }
+
+  virtual SourceRange getSourceRange() const { 
+    return isFreeIvar() ? SourceRange(Loc)
+    : SourceRange(getBase()->getLocStart(), Loc); 
+  }
   
   static bool classof(const Stmt *T) { 
     return T->getStmtClass() == ObjCIvarRefExprClass; 
@@ -218,19 +228,24 @@
                       SourceLocation l, Expr *base)
     : Expr(ObjCPropertyRefExprClass, t), AsProperty(PD), IdLoc(l), Base(base) {
   }
-  ObjCPropertyDecl *getProperty() const {
-    return AsProperty;
-  }
   
-  virtual SourceRange getSourceRange() const {
-    return SourceRange(getBase()->getLocStart(), IdLoc);
-  }
+  explicit ObjCPropertyRefExpr(EmptyShell Empty)
+    : Expr(ObjCPropertyRefExprClass, Empty) {}
+
+  ObjCPropertyDecl *getProperty() const { return AsProperty; }
+  void setProperty(ObjCPropertyDecl *D) { AsProperty = D; }
+  
   const Expr *getBase() const { return cast<Expr>(Base); }
   Expr *getBase() { return cast<Expr>(Base); }
-  void setBase(Expr * base) { Base = base; }
+  void setBase(Expr *base) { Base = base; }
   
   SourceLocation getLocation() const { return IdLoc; }
+  void setLocation(SourceLocation L) { IdLoc = L; }
 
+  virtual SourceRange getSourceRange() const {
+    return SourceRange(getBase()->getLocStart(), IdLoc);
+  }
+  
   static bool classof(const Stmt *T) { 
     return T->getStmtClass() == ObjCPropertyRefExprClass; 
   }
@@ -261,7 +276,8 @@
                  ObjCMethodDecl *setter,
                  SourceLocation l, Expr *base)
     : Expr(ObjCKVCRefExprClass, t), Setter(setter),
-      Getter(getter), Loc(l), Base(base), ClassProp(0), ClassLoc(SourceLocation()) {
+      Getter(getter), Loc(l), Base(base), ClassProp(0),
+      ClassLoc(SourceLocation()) {
     }
   ObjCKVCRefExpr(ObjCMethodDecl *getter,
                  QualType t, 
@@ -270,17 +286,14 @@
     : Expr(ObjCKVCRefExprClass, t), Setter(setter),
       Getter(getter), Loc(l), Base(0), ClassProp(C), ClassLoc(CL) {
     }
-  
-  ObjCMethodDecl *getGetterMethod() const {
-      return Getter;
-  }
-  ObjCMethodDecl *getSetterMethod() const {
-    return Setter;
-  }
+  explicit ObjCKVCRefExpr(EmptyShell Empty) : Expr(ObjCKVCRefExprClass, Empty){}
 
-  ObjCInterfaceDecl *getClassProp() const {
-    return ClassProp;
-  }
+  ObjCMethodDecl *getGetterMethod() const { return Getter; }
+  ObjCMethodDecl *getSetterMethod() const { return Setter; }
+  ObjCInterfaceDecl *getClassProp() const { return ClassProp; }
+  void setGetterMethod(ObjCMethodDecl *D) { Getter = D; }
+  void setSetterMethod(ObjCMethodDecl *D) { Setter = D; }
+  void setClassProp(ObjCInterfaceDecl *D) { ClassProp = D; }
   
   virtual SourceRange getSourceRange() const {
     if (Base)
@@ -289,9 +302,12 @@
   }
   const Expr *getBase() const { return cast<Expr>(Base); }
   Expr *getBase() { return cast<Expr>(Base); }
-  void setBase(Expr * base) { Base = base; }
+  void setBase(Expr *base) { Base = base; }
     
   SourceLocation getLocation() const { return Loc; }
+  void setLocation(SourceLocation L) { Loc = L; }
+  SourceLocation getClassLoc() const { return ClassLoc; }
+  void setClassLoc(SourceLocation L) { ClassLoc = L; }
     
   static bool classof(const Stmt *T) { 
     return T->getStmtClass() == ObjCKVCRefExprClass; 
@@ -324,7 +340,7 @@
   // Constants for indexing into SubExprs.
   enum { RECEIVER=0, ARGS_START=1 };
 
-  // Bit-swizziling flags.
+  // Bit-swizzling flags.
   enum { IsInstMeth=0, IsClsMethDeclUnknown, IsClsMethDeclKnown, Flags=0x3 };
   unsigned getFlag() const { return (uintptr_t) SubExprs[RECEIVER] & Flags; }
   
@@ -391,14 +407,14 @@
   ///  and IdentifierInfo* of the invoked class.  Both can be NULL if this
   ///  is an instance message, and the ObjCInterfaceDecl* can be NULL if none
   ///  was available when this ObjCMessageExpr object was constructed.  
-  ClassInfo getClassInfo() const;  
+  ClassInfo getClassInfo() const; 
+  void setClassInfo(const ClassInfo &C);
   
   /// getClassName - For class methods, this returns the invoked class,
   ///  and returns NULL otherwise.  For instance methods, use getReceiver.  
   IdentifierInfo *getClassName() const {
     return getClassInfo().second;
   }
-
   
   /// getNumArgs - Return the number of actual arguments to this call.
   unsigned getNumArgs() const { return NumArgs; }
@@ -418,7 +434,13 @@
     assert(Arg < NumArgs && "Arg access out of range!");
     SubExprs[Arg+ARGS_START] = ArgExpr;
   }
+  
+  SourceLocation getLeftLoc() const { return LBracloc; }
+  SourceLocation getRightLoc() const { return RBracloc; }
 
+  void setLeftLoc(SourceLocation L) { LBracloc = L; }
+  void setRightLoc(SourceLocation L) { RBracloc = L; }
+  
   void setSourceRange(SourceRange R) {
     LBracloc = R.getBegin();
     RBracloc = R.getEnd();
@@ -452,7 +474,11 @@
 public:
   ObjCSuperExpr(SourceLocation L, QualType Type) 
     : Expr(ObjCSuperExprClass, Type), Loc(L) { }
+  explicit ObjCSuperExpr(EmptyShell Empty) : Expr(ObjCSuperExprClass, Empty) {}
 
+  SourceLocation getLoc() const { return Loc; }
+  void setLoc(SourceLocation L) { Loc = L; }
+  
   virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
 
   static bool classof(const Stmt *T) { 

Modified: cfe/trunk/include/clang/Frontend/PCHBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PCHBitCodes.h?rev=70100&r1=70099&r2=70100&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/PCHBitCodes.h (original)
+++ cfe/trunk/include/clang/Frontend/PCHBitCodes.h Sat Apr 25 19:44:05 2009
@@ -553,19 +553,24 @@
       
       // Objective-C
       
-      /// \brief A ObjCStringLiteral record.
+      /// \brief An ObjCStringLiteral record.
       EXPR_OBJC_STRING_LITERAL,
-      /// \brief A ObjCEncodeExpr record.
+      /// \brief An ObjCEncodeExpr record.
       EXPR_OBJC_ENCODE,
-      /// \brief A ObjCSelectorExpr record.
+      /// \brief An ObjCSelectorExpr record.
       EXPR_OBJC_SELECTOR_EXPR,
-      /// \brief A ObjCProtocolExpr record.
+      /// \brief An ObjCProtocolExpr record.
       EXPR_OBJC_PROTOCOL_EXPR,
-      /// \brief A ObjCMessageExpr record.
-      EXPR_OBJC_MESSAGE_EXPR
-      
-      // FIXME: From ExprObjC.h: ObjCIvarRefExpr, ObjCPropertyRefExpr,
-      // ObjCKVCRefExpr, ObjCSuperExpr
+      /// \brief An ObjCIvarRefExpr record.
+      EXPR_OBJC_IVAR_REF_EXPR,
+      /// \brief An ObjCPropertyRefExpr record.
+      EXPR_OBJC_PROPERTY_REF_EXPR,
+      /// \brief An ObjCKVCRefExpr record.
+      EXPR_OBJC_KVC_REF_EXPR,
+      /// \brief An ObjCMessageExpr record.
+      EXPR_OBJC_MESSAGE_EXPR,
+      /// \brief An ObjCSuperExpr record.
+      EXPR_OBJC_SUPER_EXPR
     };
 
     /// \brief The kinds of designators that can occur in a

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=70100&r1=70099&r2=70100&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sat Apr 25 19:44:05 2009
@@ -1525,6 +1525,16 @@
   }
 }
 
+void ObjCMessageExpr::setClassInfo(const ObjCMessageExpr::ClassInfo &CI) {
+  if (CI.first == 0 && CI.second == 0)
+    SubExprs[RECEIVER] = (Expr*)((uintptr_t)0 | IsInstMeth);
+  else if (CI.first == 0)
+    SubExprs[RECEIVER] = (Expr*)((uintptr_t)CI.second | IsClsMethDeclUnknown);
+  else
+    SubExprs[RECEIVER] = (Expr*)((uintptr_t)CI.first | IsClsMethDeclKnown);
+}
+
+
 bool ChooseExpr::isConditionTrue(ASTContext &C) const {
   return getCond()->getIntegerConstantExprValue(C) != 0;
 }

Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=70100&r1=70099&r2=70100&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Sat Apr 25 19:44:05 2009
@@ -497,7 +497,11 @@
     unsigned VisitObjCEncodeExpr(ObjCEncodeExpr *E);
     unsigned VisitObjCSelectorExpr(ObjCSelectorExpr *E);
     unsigned VisitObjCProtocolExpr(ObjCProtocolExpr *E);
+    unsigned VisitObjCIvarRefExpr(ObjCIvarRefExpr *E);
+    unsigned VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E);
+    unsigned VisitObjCKVCRefExpr(ObjCKVCRefExpr *E);
     unsigned VisitObjCMessageExpr(ObjCMessageExpr *E);
+    unsigned VisitObjCSuperExpr(ObjCSuperExpr *E);
   };
 }
 
@@ -1081,21 +1085,60 @@
   return 0;
 }
 
+unsigned PCHStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
+  VisitExpr(E);
+  E->setDecl(cast<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++])));
+  E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
+  E->setBase(cast<Expr>(StmtStack.back()));
+  E->setIsArrow(Record[Idx++]);
+  E->setIsFreeIvar(Record[Idx++]);
+  return 1;
+}
+
+unsigned PCHStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
+  VisitExpr(E);
+  E->setProperty(cast<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
+  E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
+  E->setBase(cast<Expr>(StmtStack.back()));
+  return 1;
+}
+
+unsigned PCHStmtReader::VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) {
+  VisitExpr(E);
+  E->setGetterMethod(cast<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++])));
+  E->setSetterMethod(cast<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++])));
+  E->setClassProp(cast<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
+  E->setBase(cast<Expr>(StmtStack.back()));
+  E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
+  E->setClassLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+  return 1;
+}
+
 unsigned PCHStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
   VisitExpr(E);
   E->setNumArgs(Record[Idx++]);
-  SourceRange SR(SourceLocation::getFromRawEncoding(Record[Idx++]),
-                 SourceLocation::getFromRawEncoding(Record[Idx++]));
-  E->setSourceRange(SR);
+  E->setLeftLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+  E->setRightLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
   E->setSelector(Reader.GetSelector(Record, Idx));
   E->setMethodDecl(cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++])));
-  // FIXME: deal with class messages.
+  
+  ObjCMessageExpr::ClassInfo CI;
+  CI.first = cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++]));
+  CI.second = Reader.GetIdentifierInfo(Record, Idx);
+  if (E->getMethodDecl() == 0)
+    E->setClassInfo(CI);
+  
   E->setReceiver(cast<Expr>(StmtStack[StmtStack.size() - E->getNumArgs() - 1]));
   for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
     E->setArg(I, cast<Expr>(StmtStack[StmtStack.size() - N + I]));
   return E->getNumArgs() + 1;
 }
 
+unsigned PCHStmtReader::VisitObjCSuperExpr(ObjCSuperExpr *E) {
+  VisitExpr(E);
+  E->setLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+  return 0;
+}
 
 //===----------------------------------------------------------------------===//
 // PCH reader implementation
@@ -3312,9 +3355,21 @@
     case pch::EXPR_OBJC_PROTOCOL_EXPR:
       S = new (Context) ObjCProtocolExpr(Empty);
       break;
+    case pch::EXPR_OBJC_IVAR_REF_EXPR:
+      S = new (Context) ObjCIvarRefExpr(Empty);
+      break;
+    case pch::EXPR_OBJC_PROPERTY_REF_EXPR:
+      S = new (Context) ObjCPropertyRefExpr(Empty);
+      break;
+    case pch::EXPR_OBJC_KVC_REF_EXPR:
+      S = new (Context) ObjCKVCRefExpr(Empty);
+      break;
     case pch::EXPR_OBJC_MESSAGE_EXPR:
       S = new (Context) ObjCMessageExpr(Empty);
       break;
+    case pch::EXPR_OBJC_SUPER_EXPR:
+      S = new (Context) ObjCSuperExpr(Empty);
+      break;
     }
 
     // We hit a STMT_STOP, so we're done with this expression.

Modified: cfe/trunk/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriter.cpp?rev=70100&r1=70099&r2=70100&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriter.cpp Sat Apr 25 19:44:05 2009
@@ -672,7 +672,11 @@
     void VisitObjCEncodeExpr(ObjCEncodeExpr *E);
     void VisitObjCSelectorExpr(ObjCSelectorExpr *E);
     void VisitObjCProtocolExpr(ObjCProtocolExpr *E);
+    void VisitObjCIvarRefExpr(ObjCIvarRefExpr *E);
+    void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E);
+    void VisitObjCKVCRefExpr(ObjCKVCRefExpr *E);
     void VisitObjCMessageExpr(ObjCMessageExpr *E);
+    void VisitObjCSuperExpr(ObjCSuperExpr *E);
   };
 }
 
@@ -1199,21 +1203,59 @@
   Code = pch::EXPR_OBJC_PROTOCOL_EXPR;
 }
 
+void PCHStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
+  VisitExpr(E);
+  Writer.AddDeclRef(E->getDecl(), Record);
+  Writer.AddSourceLocation(E->getLocation(), Record);
+  Writer.WriteSubStmt(E->getBase());
+  Record.push_back(E->isArrow());
+  Record.push_back(E->isFreeIvar());
+}
+
+void PCHStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
+  VisitExpr(E);
+  Writer.AddDeclRef(E->getProperty(), Record);
+  Writer.AddSourceLocation(E->getLocation(), Record);
+  Writer.WriteSubStmt(E->getBase());
+}
+
+void PCHStmtWriter::VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) {
+  VisitExpr(E);
+  Writer.AddDeclRef(E->getGetterMethod(), Record);
+  Writer.AddDeclRef(E->getSetterMethod(), Record);
+  
+  // NOTE: ClassProp and Base are mutually exclusive.
+  Writer.AddDeclRef(E->getClassProp(), Record);
+  Writer.WriteSubStmt(E->getBase());
+  Writer.AddSourceLocation(E->getLocation(), Record);
+  Writer.AddSourceLocation(E->getClassLoc(), Record);
+}
+
 void PCHStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
   VisitExpr(E);
   Record.push_back(E->getNumArgs());
-  Writer.AddSourceLocation(E->getSourceRange().getBegin(), Record);
-  Writer.AddSourceLocation(E->getSourceRange().getEnd(), Record);
+  Writer.AddSourceLocation(E->getLeftLoc(), Record);
+  Writer.AddSourceLocation(E->getRightLoc(), Record);
   Writer.AddSelectorRef(E->getSelector(), Record);
   Writer.AddDeclRef(E->getMethodDecl(), Record); // optional
-  // FIXME: deal with class messages.
+
+  ObjCMessageExpr::ClassInfo CI = E->getClassInfo();
   Writer.WriteSubStmt(E->getReceiver());
+  Writer.AddDeclRef(CI.first, Record);
+  Writer.AddIdentifierRef(CI.second, Record);
+  
   for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
        Arg != ArgEnd; ++Arg)
     Writer.WriteSubStmt(*Arg);
   Code = pch::EXPR_OBJC_MESSAGE_EXPR;
 }
 
+void PCHStmtWriter::VisitObjCSuperExpr(ObjCSuperExpr *E) {
+  VisitExpr(E);
+  Writer.AddSourceLocation(E->getLoc(), Record);
+
+}
+
 
 //===----------------------------------------------------------------------===//
 // PCHWriter Implementation





More information about the cfe-commits mailing list