parse identifier expressions properly.  This allows us diagnose this:

typedef int X;

int A() {
  return X;
}

int B() {
  return Y;
}

as:

/Users/sabre/test.c:5:10: error: unexpected type name 'X': expected expression
return X;
       ^
/Users/sabre/test.c:9:10: error: use of undeclared 'Y' value
return Y;
       ^

llvm-svn: 39192
diff --git a/clang/Parse/ParseExpr.cpp b/clang/Parse/ParseExpr.cpp
index d78836b..645ab33 100644
--- a/clang/Parse/ParseExpr.cpp
+++ b/clang/Parse/ParseExpr.cpp
@@ -201,8 +201,8 @@
   //   primary-expression: identifier
   
   // Let the actions module handle the identifier.
-  ExprResult Res = Actions.ParseSimplePrimaryExpr(Tok.getLocation(),
-                                                  Tok.getKind());
+  ExprResult Res = Actions.ParseIdentifierExpr(Tok.getLocation(),
+                                               *Tok.getIdentifierInfo());
   
   // Because we have to parse an entire cast-expression before starting the
   // ParseRHSOfBinaryExpression method (which parses any trailing binops), we
@@ -231,8 +231,8 @@
   //   primary-expression: identifier
   
   // Let the actions module handle the identifier.
-  ExprResult Res = Actions.ParseSimplePrimaryExpr(Tok.getLocation(),
-                                                  Tok.getKind());
+  ExprResult Res = Actions.ParseIdentifierExpr(Tok.getLocation(),
+                                               *Tok.getIdentifierInfo());
   
   // Because we have to parse an entire cast-expression before starting the
   // ParseRHSOfBinaryExpression method (which parses any trailing binops), we
@@ -481,6 +481,11 @@
 
   case tok::identifier:        // primary-expression: identifier
                                // constant: enumeration-constant
+    Res = Actions.ParseIdentifierExpr(Tok.getLocation(),
+                                      *Tok.getIdentifierInfo());
+    ConsumeToken();
+    // These can be followed by postfix-expr pieces.
+    return ParsePostfixExpressionSuffix(Res);
   case tok::char_constant:     // constant: character-constant
   case tok::kw___func__:       // primary-expression: __func__ [C99 6.4.2.2]
   case tok::kw___FUNCTION__:   // primary-expression: __FUNCTION__ [GNU]