Update Parser::ParseTypeName to return a TypeResult, which also tells
us whether there was an error in trying to parse a type-name (type-id
in C++). This allows propagation of errors further in the compiler,
suppressing more bogus error messages.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64922 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index 52824f5..747a4de 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -240,9 +240,10 @@
   if(Tok.is(tok::equal)) {
     SourceLocation EqualLoc = ConsumeToken();
     SourceLocation DefaultLoc = Tok.getLocation();
-    if (TypeTy *DefaultType = ParseTypeName())
+    TypeResult DefaultType = ParseTypeName();
+    if (!DefaultType.isInvalid())
       Actions.ActOnTypeParameterDefault(TypeParam, EqualLoc, DefaultLoc,
-                                        DefaultType);
+                                        DefaultType.get());
   }
   
   return TypeParam;
@@ -529,7 +530,10 @@
   // Therefore, we initially try to parse a type-id.
   if (isCXXTypeId(TypeIdAsTemplateArgument)) {
     ArgIsType = true;
-    return ParseTypeName();
+    TypeResult TypeArg = ParseTypeName();
+    if (TypeArg.isInvalid())
+      return 0;
+    return TypeArg.get();
   }
 
   OwningExprResult ExprArg = ParseAssignmentExpression();