[PATCH] D28318: [TableGen] Only normalize the spelling of GNU-style attributes.
Justin Lebar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 5 09:02:44 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291129: [TableGen] Only normalize the spelling of GNU-style attributes. (authored by jlebar).
Changed prior to commit:
https://reviews.llvm.org/D28318?vs=83125&id=83253#toc
Repository:
rL LLVM
https://reviews.llvm.org/D28318
Files:
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
Index: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
===================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
@@ -133,10 +133,9 @@
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 @@
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 + ";"));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28318.83253.patch
Type: text/x-patch
Size: 1379 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170105/95f54deb/attachment-0001.bin>
More information about the cfe-commits
mailing list