Fix an assertion-on-error during tentative constructor parsing by
propagating error conditions out of the various annotate-me-a-snowflake
routines.  Generally (but not universally) removes redundant diagnostics
as well as, you know, not crashing on bad code.  On the other hand,
I have just signed myself up to fix fiddly parser errors for the next
week.  Again.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97221 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 7998b26..f1e989f 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -55,7 +55,7 @@
 
 /// member access expression, e.g., the \p T:: in \p p->T::m.
 ///
-/// \returns true if a scope specifier was parsed.
+/// \returns true if there was an error parsing a scope specifier
 bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
                                             Action::TypeTy *ObjectType,
                                             bool EnteringContext,
@@ -67,7 +67,7 @@
     SS.setScopeRep(Tok.getAnnotationValue());
     SS.setRange(Tok.getAnnotationRange());
     ConsumeToken();
-    return true;
+    return false;
   }
 
   bool HasScopeSpecifier = false;
@@ -168,10 +168,10 @@
         = Actions.ActOnDependentTemplateName(TemplateKWLoc, SS, TemplateName,
                                              ObjectType, EnteringContext);
       if (!Template)
-        break;
+        return true;
       if (AnnotateTemplateIdToken(Template, TNK_Dependent_template_name,
                                   &SS, TemplateName, TemplateKWLoc, false))
-        break;
+        return true;
 
       continue;
     }
@@ -188,7 +188,7 @@
         = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
       if (CheckForDestructor && GetLookAheadToken(2).is(tok::tilde)) {
         *MayBePseudoDestructor = true;
-        return HasScopeSpecifier;
+        return false;
       }
 
       if (TemplateId->Kind == TNK_Type_template ||
@@ -258,7 +258,7 @@
           !Actions.isNonTypeNestedNameSpecifier(CurScope, SS, Tok.getLocation(),
                                                 II, ObjectType)) {
         *MayBePseudoDestructor = true;
-        return HasScopeSpecifier;
+        return false;
       }
 
       // We have an identifier followed by a '::'. Lookup this name
@@ -303,7 +303,7 @@
         ConsumeToken();
         if (AnnotateTemplateIdToken(Template, TNK, &SS, TemplateName, 
                                     SourceLocation(), false))
-          break;
+          return true;
         continue;
       }
     }
@@ -319,7 +319,7 @@
   if (CheckForDestructor && Tok.is(tok::tilde))
     *MayBePseudoDestructor = true;
 
-  return HasScopeSpecifier;
+  return false;
 }
 
 /// ParseCXXIdExpression - Handle id-expression.