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

llvm-svn: 144645
This commit is contained in:
Benjamin Kramer 2011-11-15 12:54:53 +00:00
parent 176a5cb38a
commit fee467a0d0
1 changed files with 4 additions and 0 deletions

View File

@ -303,6 +303,10 @@ void ClangDiagGroupsEmitter::run(raw_ostream &OS) {
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, ' ');