Split the DiagnosticInfo class into two disjoint classes:
one for building up the diagnostic that is in flight (DiagnosticBuilder)
and one for pulling structured information out of the diagnostic when
formatting and presenting it.

There is no functionality change with this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59849 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index e83d4f3..164ac1b 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -129,7 +129,7 @@
   NumDiagnostics = 0;
   NumErrors = 0;
   CustomDiagInfo = 0;
-  NumDiagArgs = -1;
+  CurDiagID = ~0U;
 }
 
 Diagnostic::~Diagnostic() {
@@ -215,7 +215,9 @@
 
 /// ProcessDiag - This is the method used to report a diagnostic that is
 /// finally fully formed.
-void Diagnostic::ProcessDiag(const DiagnosticInfo &Info) {
+void Diagnostic::ProcessDiag() {
+  DiagnosticInfo Info(this);
+  
   // Figure out the diagnostic level of this message.
   Diagnostic::Level DiagLevel = getDiagnosticLevel(Info.getID());
   
@@ -347,25 +349,25 @@
     unsigned StrNo = *DiagStr++ - '0';
 
     switch (getArgKind(StrNo)) {
-    case DiagnosticInfo::ak_std_string: {
+    case Diagnostic::ak_std_string: {
       const std::string &S = getArgStdStr(StrNo);
       assert(ModifierLen == 0 && "No modifiers for strings yet");
       OutStr.append(S.begin(), S.end());
       break;
     }
-    case DiagnosticInfo::ak_c_string: {
+    case Diagnostic::ak_c_string: {
       const char *S = getArgCStr(StrNo);
       assert(ModifierLen == 0 && "No modifiers for strings yet");
       OutStr.append(S, S + strlen(S));
       break;
     }
-    case DiagnosticInfo::ak_identifierinfo: {
+    case Diagnostic::ak_identifierinfo: {
       const IdentifierInfo *II = getArgIdentifier(StrNo);
       assert(ModifierLen == 0 && "No modifiers for strings yet");
       OutStr.append(II->getName(), II->getName() + II->getLength());
       break;
     }
-    case DiagnosticInfo::ak_sint: {
+    case Diagnostic::ak_sint: {
       int Val = getArgSInt(StrNo);
       
       if (ModifierIs(Modifier, ModifierLen, "select")) {
@@ -380,7 +382,7 @@
       }
       break;
     }
-    case DiagnosticInfo::ak_uint: {
+    case Diagnostic::ak_uint: {
       unsigned Val = getArgUInt(StrNo);
       
       if (ModifierIs(Modifier, ModifierLen, "select")) {