aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-06 20:24:06 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-06 20:24:06 +0000
commit95ec533a1d8c450f6c6c5e84fe85423960e13382 (patch)
treebfe77b0dccd50ed2f4b4e6299d4bc4eaafced6e7 /contrib/llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp
parent2b532af82919b9141e7fd04becf354a0a7dfa813 (diff)
parent7e7b6700743285c0af506ac6299ddf82ebd434b9 (diff)
Merge llvm, clang, lld and lldb trunk r291274, and resolve conflicts.
Notes
Notes: svn path=/projects/clang400-import/; revision=311544
Diffstat (limited to 'contrib/llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp')
-rw-r--r--contrib/llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/contrib/llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp b/contrib/llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp
index d65794e86374..27ab34c1309d 100644
--- a/contrib/llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/contrib/llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -133,10 +133,9 @@ static StringRef NormalizeNameForSpellingComparison(StringRef Name) {
return Name.trim("_");
}
-// Normalize attribute spelling only if the spelling has both leading
-// and trailing underscores. For example, __ms_struct__ will be
-// normalized to "ms_struct"; __cdecl will remain intact.
-static StringRef NormalizeAttrSpelling(StringRef AttrSpelling) {
+// Normalize the spelling of a GNU attribute (i.e. "x" in "__attribute__((x))"),
+// removing "__" if it appears at the beginning and end of the attribute's name.
+static StringRef NormalizeGNUAttrSpelling(StringRef AttrSpelling) {
if (AttrSpelling.startswith("__") && AttrSpelling.endswith("__")) {
AttrSpelling = AttrSpelling.substr(2, AttrSpelling.size() - 4);
}
@@ -3045,7 +3044,11 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
assert(Matches && "Unsupported spelling variety found");
- Spelling += NormalizeAttrSpelling(RawSpelling);
+ if (Variety == "GNU")
+ Spelling += NormalizeGNUAttrSpelling(RawSpelling);
+ else
+ Spelling += RawSpelling;
+
if (SemaHandler)
Matches->push_back(StringMatcher::StringPair(Spelling,
"return AttributeList::AT_" + AttrName + ";"));