Added LateParsed property to TableGen attributes.

This patch was written by DeLesley Hutchins.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139300 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Caitlin Sadowski 2011-09-08 17:40:49 +00:00
parent 9ea33b0c03
commit 5d97ee31bb
3 changed files with 43 additions and 0 deletions

View File

@ -758,3 +758,26 @@ void ClangAttrSpellingListEmitter::run(raw_ostream &OS) {
}
}
void ClangAttrLateParsedListEmitter::run(raw_ostream &OS) {
OS << "// This file is generated by TableGen. Do not edit.\n\n";
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
for (std::vector<Record*>::iterator I = Attrs.begin(), E = Attrs.end();
I != E; ++I) {
Record &Attr = **I;
bool LateParsed = Attr.getValueAsBit("LateParsed");
if (LateParsed) {
std::vector<StringRef> Spellings =
getValueAsListOfStrings(Attr, "Spellings");
for (std::vector<StringRef>::const_iterator I = Spellings.begin(),
E = Spellings.end(); I != E; ++I) {
OS << ".Case(\"" << (*I) << "\", " << LateParsed << ")\n";
}
}
}
}

View File

@ -96,6 +96,19 @@ class ClangAttrSpellingListEmitter : public TableGenBackend {
void run(raw_ostream &OS);
};
/// ClangAttrLateParsedListEmitter emits the LateParsed property for attributes
/// for clang.
class ClangAttrLateParsedListEmitter : public TableGenBackend {
RecordKeeper &Records;
public:
explicit ClangAttrLateParsedListEmitter(RecordKeeper &R)
: Records(R)
{}
void run(raw_ostream &OS);
};
}
#endif

View File

@ -68,6 +68,7 @@ enum ActionType {
GenClangAttrPCHRead,
GenClangAttrPCHWrite,
GenClangAttrSpellingList,
GenClangAttrLateParsedList,
GenClangDiagsDefs,
GenClangDiagGroups,
GenClangDiagsIndexName,
@ -139,6 +140,9 @@ namespace {
clEnumValN(GenClangAttrSpellingList,
"gen-clang-attr-spelling-list",
"Generate a clang attribute spelling list"),
clEnumValN(GenClangAttrLateParsedList,
"gen-clang-attr-late-parsed-list",
"Generate a clang attribute LateParsed list"),
clEnumValN(GenClangDiagsDefs, "gen-clang-diags-defs",
"Generate Clang diagnostics definitions"),
clEnumValN(GenClangDiagGroups, "gen-clang-diag-groups",
@ -296,6 +300,9 @@ int main(int argc, char **argv) {
case GenClangAttrSpellingList:
ClangAttrSpellingListEmitter(Records).run(Out.os());
break;
case GenClangAttrLateParsedList:
ClangAttrLateParsedListEmitter(Records).run(Out.os());
break;
case GenClangDiagsDefs:
ClangDiagsDefsEmitter(Records, ClangComponent).run(Out.os());
break;