Complete PCH support for ObjCPropertyImplDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110570 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index 6c0bdf6..7aab7b7 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -526,7 +526,8 @@
                cast_or_null<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
   D->setPropertyIvarDecl(
                    cast_or_null<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++])));
-  // FIXME. read GetterCXXConstructor and SetterCXXAssignment
+  D->setGetterCXXConstructor(Reader.ReadExpr(Cursor));
+  D->setSetterCXXAssignment(Reader.ReadExpr(Cursor));
 }
 
 void PCHDeclReader::VisitFieldDecl(FieldDecl *FD) {
diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp
index 6a78140..a509ed1 100644
--- a/lib/Frontend/PCHWriterDecl.cpp
+++ b/lib/Frontend/PCHWriterDecl.cpp
@@ -305,8 +305,10 @@
   VisitNamedDecl(D);
   // FIXME: convert to LazyStmtPtr?
   // Unlike C/C++, method bodies will never be in header files.
-  Record.push_back(D->getBody() != 0);
-  if (D->getBody() != 0) {
+  bool HasBodyStuff = D->getBody() != 0     ||
+                      D->getSelfDecl() != 0 || D->getCmdDecl() != 0;
+  Record.push_back(HasBodyStuff);
+  if (HasBodyStuff) {
     Writer.AddStmt(D->getBody());
     Writer.AddDeclRef(D->getSelfDecl(), Record);
     Writer.AddDeclRef(D->getCmdDecl(), Record);
@@ -478,7 +480,8 @@
   Writer.AddSourceLocation(D->getLocStart(), Record);
   Writer.AddDeclRef(D->getPropertyDecl(), Record);
   Writer.AddDeclRef(D->getPropertyIvarDecl(), Record);
-  // FIXME. write GetterCXXConstructor and SetterCXXAssignment.
+  Writer.AddStmt(D->getGetterCXXConstructor());
+  Writer.AddStmt(D->getSetterCXXAssignment());
   Code = pch::DECL_OBJC_PROPERTY_IMPL;
 }
 
diff --git a/test/PCH/objcxx-ivar-class.h b/test/PCH/objcxx-ivar-class.h
index aa114e5..50ebda7 100644
--- a/test/PCH/objcxx-ivar-class.h
+++ b/test/PCH/objcxx-ivar-class.h
@@ -1,11 +1,15 @@
 struct S {
     S();
+    S(const S&);
+    S& operator= (const S&);
 };
 
 @interface C {
-    S s;
+    S position;
 }
+@property(assign, nonatomic) S position;
 @end
 
 @implementation C
+    @synthesize position;
 @end
diff --git a/test/PCH/objcxx-ivar-class.mm b/test/PCH/objcxx-ivar-class.mm
index 48d359c..89d3e08 100644
--- a/test/PCH/objcxx-ivar-class.mm
+++ b/test/PCH/objcxx-ivar-class.mm
@@ -5,5 +5,11 @@
 // RUN: %clang_cc1 -x objective-c++-header -emit-pch -o %t %S/objcxx-ivar-class.h
 // RUN: %clang_cc1 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
 
+// CHECK: [C position]
+// CHECK: call void @_ZN1SC1ERKS_
+
+// CHECK: [C setPosition:]
+// CHECK: call %struct.S* @_ZN1SaSERKS_
+
 // CHECK: [C .cxx_destruct]
 // CHECK: [C .cxx_construct]