mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-20 14:29:27 +00:00
encode subgroups into the clang .inc file. -Wall now works!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69257 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
16f2ffd158
commit
9efac568f0
@ -64,6 +64,7 @@ void ClangDiagsDefsEmitter::run(std::ostream &OS) {
|
||||
struct GroupInfo {
|
||||
std::vector<const Record*> DiagsInGroup;
|
||||
std::vector<std::string> SubGroups;
|
||||
unsigned IDNo;
|
||||
};
|
||||
|
||||
void ClangDiagGroupsEmitter::run(std::ostream &OS) {
|
||||
@ -93,29 +94,44 @@ void ClangDiagGroupsEmitter::run(std::ostream &OS) {
|
||||
GI.SubGroups.push_back(SubGroups[j]->getValueAsString("GroupName"));
|
||||
}
|
||||
|
||||
// Assign unique ID numbers to the groups.
|
||||
unsigned IDNo = 0;
|
||||
for (std::map<std::string, GroupInfo>::iterator
|
||||
I = DiagsInGroup.begin(), E = DiagsInGroup.end(); I != E; ++I, ++IDNo)
|
||||
I->second.IDNo = IDNo;
|
||||
|
||||
// Walk through the groups emitting an array for each diagnostic of the diags
|
||||
// that are mapped to.
|
||||
OS << "\n#ifdef GET_DIAG_ARRAYS\n";
|
||||
unsigned IDNo = 0;
|
||||
unsigned MaxLen = 0;
|
||||
for (std::map<std::string, GroupInfo>::iterator
|
||||
I = DiagsInGroup.begin(), E = DiagsInGroup.end(); I != E; ++I) {
|
||||
MaxLen = std::max(MaxLen, (unsigned)I->first.size());
|
||||
|
||||
std::vector<const Record*> &V = I->second.DiagsInGroup;
|
||||
if (V.empty()) continue;
|
||||
if (!V.empty()) {
|
||||
OS << "static const short DiagArray" << I->second.IDNo << "[] = { ";
|
||||
for (unsigned i = 0, e = V.size(); i != e; ++i)
|
||||
OS << "diag::" << V[i]->getName() << ", ";
|
||||
OS << "-1 };\n";
|
||||
}
|
||||
|
||||
OS << "static const short DiagArray" << IDNo++
|
||||
<< "[] = { ";
|
||||
for (unsigned i = 0, e = V.size(); i != e; ++i)
|
||||
OS << "diag::" << V[i]->getName() << ", ";
|
||||
OS << "-1 };\n";
|
||||
const std::vector<std::string> &SubGroups = I->second.SubGroups;
|
||||
if (!SubGroups.empty()) {
|
||||
OS << "static const char DiagSubGroup" << I->second.IDNo << "[] = { ";
|
||||
for (unsigned i = 0, e = SubGroups.size(); i != e; ++i) {
|
||||
std::map<std::string, GroupInfo>::iterator RI =
|
||||
DiagsInGroup.find(SubGroups[i]);
|
||||
assert(RI != DiagsInGroup.end() && "Referenced without existing?");
|
||||
OS << RI->second.IDNo << ", ";
|
||||
}
|
||||
OS << "-1 };\n";
|
||||
}
|
||||
}
|
||||
OS << "#endif // GET_DIAG_ARRAYS\n\n";
|
||||
|
||||
// Emit the table now.
|
||||
OS << "\n#ifdef GET_DIAG_TABLE\n";
|
||||
IDNo = 0;
|
||||
for (std::map<std::string, GroupInfo>::iterator
|
||||
I = DiagsInGroup.begin(), E = DiagsInGroup.end(); I != E; ++I) {
|
||||
std::string S = I->first;
|
||||
@ -128,10 +144,13 @@ void ClangDiagGroupsEmitter::run(std::ostream &OS) {
|
||||
if (I->second.DiagsInGroup.empty())
|
||||
OS << "0, ";
|
||||
else
|
||||
OS << "DiagArray" << IDNo++ << ", ";
|
||||
OS << "DiagArray" << I->second.IDNo << ", ";
|
||||
|
||||
// FIXME: Subgroups.
|
||||
OS << 0;
|
||||
// Subgroups.
|
||||
if (I->second.SubGroups.empty())
|
||||
OS << 0;
|
||||
else
|
||||
OS << "DiagSubGroup" << I->second.IDNo;
|
||||
OS << " },\n";
|
||||
}
|
||||
OS << "#endif // GET_DIAG_TABLE\n\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user