Added property decl support for protocols.
Added assertion if unexpected property decls are found where they don't belong.
Consolidated property decl. printing by using a helper function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49862 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 3b6f8ec..eb9fa43 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -695,13 +695,15 @@
          || isa<ObjCProtocolDecl>(ClassDecl);
   bool checkIdenticalMethods = isa<ObjCImplementationDecl>(ClassDecl);
   
-  // TODO: property declaration in category and protocols.
   if (pNum != 0)
     if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(ClassDecl))
       IDecl->addProperties((ObjCPropertyDecl**)allProperties, pNum);
+    else if (ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl))
+      CDecl->addProperties((ObjCPropertyDecl**)allProperties, pNum);
+    else if (ObjCProtocolDecl *PDecl = dyn_cast<ObjCProtocolDecl>(ClassDecl))
+          PDecl->addProperties((ObjCPropertyDecl**)allProperties, pNum);
     else
-      if (ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl))
-        CDecl->addProperties((ObjCPropertyDecl**)allProperties, pNum);
+      assert(false && "ActOnAtEnd - property declaration misplaced");
   
   for (unsigned i = 0; i < allNum; i++ ) {
     ObjCMethodDecl *Method =