diff options
| author | Anders Carlsson <andersca@mac.com> | 2010-10-20 01:21:53 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2010-10-20 01:21:53 +0000 |
| commit | 83123a47ce790c9a894b2c39400fa8572edfa8c5 (patch) | |
| tree | 9eb5c7bef168899a0a4150848ad4d4993247f78a /llvm/utils/TableGen/ClangAttrEmitter.cpp | |
| parent | 30bb275b6b73a3454aaab44b51e3f6dc8b532c41 (diff) | |
| download | bcm5719-llvm-83123a47ce790c9a894b2c39400fa8572edfa8c5.tar.gz bcm5719-llvm-83123a47ce790c9a894b2c39400fa8572edfa8c5.zip | |
Add a way to emit StringSwitch of clang attribute spellings.
llvm-svn: 116899
Diffstat (limited to 'llvm/utils/TableGen/ClangAttrEmitter.cpp')
| -rw-r--r-- | llvm/utils/TableGen/ClangAttrEmitter.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/ClangAttrEmitter.cpp b/llvm/utils/TableGen/ClangAttrEmitter.cpp index 8340ebfb1fc..db10d7906e2 100644 --- a/llvm/utils/TableGen/ClangAttrEmitter.cpp +++ b/llvm/utils/TableGen/ClangAttrEmitter.cpp @@ -637,3 +637,21 @@ void ClangAttrPCHWriteEmitter::run(raw_ostream &OS) { } OS << " }\n"; } + +void ClangAttrSpellingListEmitter::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; + + std::vector<StringRef> Spellings = getValueAsListOfStrings(Attr, "Spellings"); + + for (std::vector<StringRef>::const_iterator I = Spellings.begin(), E = Spellings.end(); I != E; ++I) { + StringRef Spelling = *I; + OS << ".Case(\"" << Spelling << "\", true)\n"; + } + } + +} |

