Implement property '.' notation on Factory/Class objects. Parser changes aren't very pretty:-(

This fixes <rdar://problem/6496506> Implement class setter/getter for properties.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66465 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 331f318..000cb9d 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -569,6 +569,28 @@
         return ParseCastExpression(isUnaryExpression, isAddressOfOperand);
     }
 
+    // Support 'Class.property' notation.
+    // We don't use isTokObjCMessageIdentifierReceiver(), since it allows 
+    // 'super' (which is inappropriate here).
+    if (getLang().ObjC1 && 
+        Actions.getTypeName(*Tok.getIdentifierInfo(), 
+                            Tok.getLocation(), CurScope) &&
+        NextToken().is(tok::period)) {
+      IdentifierInfo &ReceiverName = *Tok.getIdentifierInfo();
+      SourceLocation IdentLoc = ConsumeToken();
+      SourceLocation DotLoc = ConsumeToken();
+      
+      if (Tok.isNot(tok::identifier)) {
+        Diag(Tok, diag::err_expected_ident);
+        return ExprError();
+      }
+      IdentifierInfo &PropertyName = *Tok.getIdentifierInfo();
+      SourceLocation PropertyLoc = ConsumeToken();
+      
+      Res = Actions.ActOnClassPropertyRefExpr(ReceiverName, PropertyName,
+                                              IdentLoc, PropertyLoc);
+      return move(Res);
+    }
     // Consume the identifier so that we can see if it is followed by a '('.
     // Function designators are allowed to be undeclared (C99 6.5.1p2), so we
     // need to know whether or not this identifier is a function designator or