Convert the lexer and start converting the PP over to using canonical Diag methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59511 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index 4e93600..8ddd62f 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -306,11 +306,10 @@
 
 /// Diag - Forwarding function for diagnostics.  This translate a source
 /// position in the current buffer into a SourceLocation object for rendering.
-void Lexer::Diag(const char *Loc, unsigned DiagID,
-                 const std::string &Msg) const {
+DiagnosticInfo Lexer::Diag(const char *Loc, unsigned DiagID) const {
   if (LexingRawMode && Diagnostic::isBuiltinNoteWarningOrExtension(DiagID))
-    return;
-  PP->Diag(getSourceLocation(Loc), DiagID, Msg);
+    return DiagnosticInfo(0, FullSourceLoc(), 0);
+  return PP->Diag(getSourceLocation(Loc), DiagID);
 }
 
 //===----------------------------------------------------------------------===//
@@ -340,14 +339,14 @@
 /// whether trigraphs are enabled or not.
 static char DecodeTrigraphChar(const char *CP, Lexer *L) {
   char Res = GetTrigraphCharForLetter(*CP);
-  if (Res && L) {
-    if (!L->getFeatures().Trigraphs) {
-      L->Diag(CP-2, diag::trigraph_ignored);
-      return 0;
-    } else {
-      L->Diag(CP-2, diag::trigraph_converted, std::string()+Res);
-    }
+  if (!Res || !L) return Res;
+  
+  if (!L->getFeatures().Trigraphs) {
+    L->Diag(CP-2, diag::trigraph_ignored);
+    return 0;
   }
+    
+  L->Diag(CP-2, diag::trigraph_converted) << std::string()+Res;
   return Res;
 }