Change a couple of the Parser::Diag methods to return DiagnosticInfo
and let the clients push whatever they want into the DiagnosticInfo
instead of hard coding a few forms.  Also switch various clients to
use Diag(Tok, ...) instead of Diag(Tok.getLocation(), ...) as the
canonical form to simplify the code a bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59509 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 19b521b..006c791 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -198,17 +198,13 @@
   TypeTy *CastTy = ParseTypeName();
   SourceLocation RAngleBracketLoc = Tok.getLocation();
 
-  if (ExpectAndConsume(tok::greater, diag::err_expected_greater)) {
-    Diag(LAngleBracketLoc, diag::err_matching, "<");
-    return ExprResult(true);
-  }
+  if (ExpectAndConsume(tok::greater, diag::err_expected_greater))
+    return Diag(LAngleBracketLoc, diag::err_matching) << "<";
 
   SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
 
-  if (Tok.isNot(tok::l_paren)) {
-    Diag(Tok, diag::err_expected_lparen_after, CastName);
-    return ExprResult(true);
-  }
+  if (Tok.isNot(tok::l_paren))
+    return Diag(Tok, diag::err_expected_lparen_after) << CastName;
 
   ExprResult Result = ParseSimpleParenExpression(RParenLoc);
 
@@ -515,7 +511,7 @@
 
   // Parse one or more of the type specifiers.
   if (!MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec)) {
-    Diag(Tok.getLocation(), diag::err_operator_missing_type_specifier);
+    Diag(Tok, diag::err_operator_missing_type_specifier);
     return true;
   }
   while (MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec)) ;