diff options
author | Sean Hunt <scshunt@csclub.uwaterloo.ca> | 2012-06-19 13:36:02 +0000 |
---|---|---|
committer | Sean Hunt <scshunt@csclub.uwaterloo.ca> | 2012-06-19 13:36:02 +0000 |
commit | c20c4e79ae1957ec5a88d7653a0aeda24b67ae3a (patch) | |
tree | 3edff54387f740be9139430b2ea72839243ce10b | |
parent | 5f75768579b9b1d70d01903ab4766aede65defcc (diff) |
Stop abusing StringRef. Fixes the Windows build.
I've also removed the duplicate check for PARSED_ATTR since it seems
unnecessary, and would have made the code more complicated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158716 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | utils/TableGen/ClangAttrEmitter.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index 61f07e2db7..0df566f712 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -966,7 +966,8 @@ void EmitClangAttrSpellingList(RecordKeeper &Records, raw_ostream &OS) { std::vector<Record*> Spellings = Attr.getValueAsListOfDefs("Spellings"); for (std::vector<Record*>::const_iterator I = Spellings.begin(), E = Spellings.end(); I != E; ++I) { - StringRef Spelling = (*I)->getValueAsString("Name"); + SmallString<64> Spelling; + Spelling += (*I)->getValueAsString("Name"); OS << ".Case(\"" << Spelling << "\", true)\n"; } } @@ -1074,6 +1075,9 @@ void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) { << "} // end namespace clang\n"; } +} +#include <cstdio> +namespace clang { // Emits the list of parsed attributes. void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) { OS << "// This file is generated by TableGen. Do not edit.\n\n"; @@ -1083,7 +1087,6 @@ void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) { OS << "#endif\n\n"; std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"); - std::set<StringRef> ProcessedAttrs; for (std::vector<Record*>::iterator I = Attrs.begin(), E = Attrs.end(); I != E; ++I) { @@ -1098,16 +1101,12 @@ void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) { for (std::vector<Record*>::const_iterator I = Spellings.begin(), E = Spellings.end(); I != E; ++I) { - StringRef AttrName = (*I)->getValueAsString("Name"); + SmallString<64> AttrName; + AttrName += (*I)->getValueAsString("Name"); - AttrName = NormalizeAttrName(AttrName); - // skip if a normalized version has been processed. - if (ProcessedAttrs.find(AttrName) != ProcessedAttrs.end()) - continue; - else - ProcessedAttrs.insert(AttrName); + StringRef Spelling = NormalizeAttrName(AttrName); - OS << "PARSED_ATTR(" << AttrName << ")\n"; + OS << "PARSED_ATTR(" << Spelling << ")\n"; } } else { StringRef AttrName = Attr.getName(); @@ -1138,9 +1137,10 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) { for (std::vector<Record*>::const_iterator I = Spellings.begin(), E = Spellings.end(); I != E; ++I) { - StringRef RawSpelling = (*I)->getValueAsString("Name"); + SmallString<64> RawSpelling; + RawSpelling += (*I)->getValueAsString("Name"); StringRef AttrName = NormalizeAttrName(DistinctSpellings - ? RawSpelling + ? StringRef(RawSpelling) : StringRef(Attr.getName())); SmallString<64> Spelling; |