prove diagnostic -> group mapping information.
authorChris Lattner <sabre@nondot.org>
Thu, 16 Apr 2009 05:52:18 +0000 (05:52 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 16 Apr 2009 05:52:18 +0000 (05:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69270 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/ClangDiagnosticsEmitter.cpp

index 4d7f92968c25812fcfe4e217f1fd1f5aff920c8b..919ae9befed32b53d749cc01291fe5d323123b4c 100644 (file)
@@ -50,10 +50,22 @@ void ClangDiagsDefsEmitter::run(std::ostream &OS) {
     OS << "DIAG(" << R.getName() << ", ";
     OS << R.getValueAsDef("Class")->getName();
     OS << ", diag::" << R.getValueAsDef("DefaultMapping")->getName();
+    
+    // Description string.
     OS << ", \"";
     std::string S = R.getValueAsString("Text");
     EscapeString(S);
-    OS << S << "\")\n";
+    OS << S << "\"";
+    
+    // Warning associated with the diagnostic.
+    if (DefInit *DI = dynamic_cast<DefInit*>(R.getValueInit("Group"))) {
+      S = DI->getDef()->getValueAsString("GroupName");
+      EscapeString(S);
+      OS << ", \"" << S << "\"";
+    } else {
+      OS << ", 0";
+    }
+    OS << ")\n";
   }
 }