diff options
author | Michael Han <fragmentshaders@gmail.com> | 2013-01-24 16:46:58 +0000 |
---|---|---|
committer | Michael Han <fragmentshaders@gmail.com> | 2013-01-24 16:46:58 +0000 |
commit | 99315932997a23aa5132d041b8a241d9ec0e8745 (patch) | |
tree | c3a639009c749aa16d546db5cb65d8d41379bd48 /clang/lib/Sema/AttributeList.cpp | |
parent | 1c4e323fdd043402524a85985e068b355eecfad2 (diff) | |
download | bcm5719-llvm-99315932997a23aa5132d041b8a241d9ec0e8745.tar.gz bcm5719-llvm-99315932997a23aa5132d041b8a241d9ec0e8745.zip |
PR14922: when printing an attribute, use the real syntax of the attribute (GNU, C++11, MS Declspec) instead of hardcoded GNU syntax.
Introduce a spelling index to Attr class, which is an index into the attribute spelling list of an attribute defined in Attr.td.
This index will determine the actual spelling used by an attribute, as it incorporates both the syntax and naming of the attribute.
When constructing an attribute AST node, the spelling index is computed based on attribute kind, scope (if it's a C++11 attribute), and
name, then passed to Attr that will use the index to print itself.
Thanks to Richard Smith for the idea and review.
llvm-svn: 173358
Diffstat (limited to 'clang/lib/Sema/AttributeList.cpp')
-rw-r--r-- | clang/lib/Sema/AttributeList.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Sema/AttributeList.cpp b/clang/lib/Sema/AttributeList.cpp index 99479267a69..e227d4e840b 100644 --- a/clang/lib/Sema/AttributeList.cpp +++ b/clang/lib/Sema/AttributeList.cpp @@ -125,3 +125,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name, return ::getAttrKind(Buf); } + +unsigned AttributeList::getAttributeSpellingListIndex() const { + // Both variables will be used in tablegen generated + // attribute spell list index matching code. + StringRef Name = AttrName->getName(); + StringRef Scope = ScopeName ? ScopeName->getName() : ""; + +#include "clang/Sema/AttrSpellingListIndex.inc" + +} + |