Validate DiagGroup names in TableGen, they're used as command line arguments so we don't want shell meta chars in there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144645 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/ClangDiagnosticsEmitter.cpp b/utils/TableGen/ClangDiagnosticsEmitter.cpp
index 7a5eb1d..4435fa7 100644
--- a/utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ b/utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -303,6 +303,10 @@
     OS << "  { ";
     OS << I->first.size() << ", ";
     OS << "\"";
+    if (I->first.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+                                   "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                                   "0123456789!@#$%^*-+=:?")!=std::string::npos)
+      throw "Invalid character in diagnostic group '" + I->first + "'";
     OS.write_escaped(I->first) << "\","
                                << std::string(MaxLen-I->first.size()+1, ' ');