[llvm-commits] [llvm] r67242 - /llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
Ted Kremenek
kremenek at apple.com
Wed Mar 18 14:29:01 PDT 2009
Author: kremenek
Date: Wed Mar 18 16:28:47 2009
New Revision: 67242
URL: http://llvm.org/viewvc/llvm-project?rev=67242&view=rev
Log:
'tblgen -gen-clang-diags-options' now outputs the OptionTable:
static const WarningOption OptionTable[] = {
{"unused-macros", DIAGS(UnusedMacrosDiags)}
...
};
This table is not yet properly sorted.
Modified:
llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
Modified: llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp?rev=67242&r1=67241&r2=67242&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Wed Mar 18 16:28:47 2009
@@ -186,11 +186,6 @@
// Iterate through the OptionMap and emit the declarations.
for (OptionMap::iterator I = OM.begin(), E = OM.end(); I!=E; ++I) {
-// const RecordVal *V = findRecordVal(*I->first, "Name");
-// assert(V && "Options must have a 'Name' value.");
-// const StringInit* SV = dynamic_cast<const StringInit*>(V->getValue());
-// assert(SV && "'Name' entry must be a string.");
-
// Output the option.
OS << "static const diag::kind " << I->first->getName() << "[] = { ";
@@ -206,4 +201,23 @@
}
OS << " };\n";
}
+
+ // Now emit the OptionTable table.
+ OS << "\nstatic const WarningOption OptionTable[] = {";
+ bool first = true;
+ for (OptionMap::iterator I = OM.begin(), E = OM.end(); I!=E; ++I) {
+ const RecordVal *V = findRecordVal(*I->first, "Name");
+ assert(V && "Options must have a 'Name' value.");
+ const StringInit* SV = dynamic_cast<const StringInit*>(V->getValue());
+ assert(SV && "'Name' entry must be a string.");
+
+ if (first)
+ first = false;
+ else
+ OS << ',';
+
+ OS << "\n {\"" << SV->getValue()
+ << "\", DIAGS(" << I->first->getName() << ")}";
+ }
+ OS << "\n};\n";
}
More information about the llvm-commits
mailing list