diff options
Diffstat (limited to 'utils/TableGen/ClangAttrEmitter.cpp')
-rw-r--r-- | utils/TableGen/ClangAttrEmitter.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index abca58d578..7e1eaf8541 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/TableGen/Record.h" #include "llvm/TableGen/StringMatcher.h" @@ -1128,6 +1129,8 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) { if (SemaHandler || Ignored) { std::vector<StringRef> Spellings = getValueAsListOfStrings(Attr, "Spellings"); + std::vector<StringRef> Namespaces = + getValueAsListOfStrings(Attr, "Namespaces"); for (std::vector<StringRef>::const_iterator I = Spellings.begin(), E = Spellings.end(); I != E; ++I) { @@ -1136,16 +1139,35 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) { : Spellings.front()); StringRef Spelling = NormalizeAttrSpelling(*I); + for (std::vector<StringRef>::const_iterator NI = Namespaces.begin(), + NE = Namespaces.end(); NI != NE; ++NI) { + SmallString<64> Buf; + Buf += *NI; + Buf += "::"; + Buf += Spelling; + + if (SemaHandler) + Matches.push_back( + StringMatcher::StringPair( + Buf.str(), + "return AttributeList::AT_" + AttrName.str() + ";")); + else + Matches.push_back( + StringMatcher::StringPair( + Buf.str(), + "return AttributeList::IgnoredAttribute;")); + } + if (SemaHandler) Matches.push_back( StringMatcher::StringPair( Spelling, - std::string("return AttributeList::AT_")+AttrName.str() + ";")); + "return AttributeList::AT_" + AttrName.str() + ";")); else Matches.push_back( StringMatcher::StringPair( Spelling, - std::string("return AttributeList::IgnoredAttribute;"))); + "return AttributeList::IgnoredAttribute;")); } } } |