Patch to allow @dynamic synthesis of property in a category,
with @synthesize being illegal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62515 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index ea7a047..90962e6 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -364,8 +364,7 @@
         return property;
   }
   
-  const ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(this);
-  if (OID) {
+  if (const ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(this)) {
     // Look through categories.
     for (ObjCCategoryDecl *Category = OID->getCategoryList();
          Category; Category = Category->getNextClassCategory()) {
@@ -384,6 +383,16 @@
     if (OID->getSuperClass())
       return OID->getSuperClass()->FindPropertyDeclaration(PropertyId);
   }
+  else if (const ObjCCategoryDecl *OCD = dyn_cast<ObjCCategoryDecl>(this)) {
+    // Look through protocols.
+    for (ObjCInterfaceDecl::protocol_iterator I = OCD->protocol_begin(),
+         E = OCD->protocol_end(); I != E; ++I) {
+      ObjCProtocolDecl *Protocol = *I;
+      ObjCPropertyDecl *property = Protocol->FindPropertyDeclaration(PropertyId);
+      if (property)
+        return property;
+    }
+  }
   return 0;
 }