Fix <rdar://problem/6268365> Parser rejects property (dot notation) access on id<protocol>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57850 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 1f88516..5ff8b0e 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -999,7 +999,15 @@
                                      MemberLoc, BaseExpr);
     }
   }
-  
+  // Handle properties on qualified "id" protocols.
+  const ObjCQualifiedIdType *QIdTy;
+  if (OpKind == tok::period && (QIdTy = BaseType->getAsObjCQualifiedIdType())) {
+    // Check protocols on qualified interfaces.
+    for (ObjCQualifiedIdType::qual_iterator I = QIdTy->qual_begin(),
+         E = QIdTy->qual_end(); I != E; ++I)
+      if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(&Member))
+        return new ObjCPropertyRefExpr(PD, PD->getType(), MemberLoc, BaseExpr);
+  }  
   // Handle 'field access' to vectors, such as 'V.xx'.
   if (BaseType->isExtVectorType() && OpKind == tok::period) {
     // Component access limited to variables (reject vec4.rg.g).