From c20c4e79ae1957ec5a88d7653a0aeda24b67ae3a Mon Sep 17 00:00:00 2001 From: Sean Hunt Date: Tue, 19 Jun 2012 13:36:02 +0000 Subject: [PATCH] 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 --- utils/TableGen/ClangAttrEmitter.cpp | 24 ++++++++++++------------ 1 file 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 Spellings = Attr.getValueAsListOfDefs("Spellings"); for (std::vector::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 +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 Attrs = Records.getAllDerivedDefinitions("Attr"); - std::set ProcessedAttrs; for (std::vector::iterator I = Attrs.begin(), E = Attrs.end(); I != E; ++I) { @@ -1098,16 +1101,12 @@ void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) { for (std::vector::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::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; -- 2.50.1