PR14922: when printing an attribute, use the real syntax of the attribute (GNU, C...
authorMichael Han <fragmentshaders@gmail.com>
Thu, 24 Jan 2013 16:46:58 +0000 (16:46 +0000)
committerMichael Han <fragmentshaders@gmail.com>
Thu, 24 Jan 2013 16:46:58 +0000 (16:46 +0000)
commit99315932997a23aa5132d041b8a241d9ec0e8745
treec3a639009c749aa16d546db5cb65d8d41379bd48
parent1c4e323fdd043402524a85985e068b355eecfad2
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
16 files changed:
clang/include/clang/AST/Attr.h
clang/include/clang/Sema/AttributeList.h
clang/include/clang/Sema/CMakeLists.txt
clang/include/clang/Sema/Makefile
clang/include/clang/Sema/Sema.h
clang/lib/Sema/AttributeList.cpp
clang/lib/Sema/CMakeLists.txt
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/TargetAttributesSema.cpp
clang/test/Sema/attr-print.c [new file with mode: 0644]
clang/test/SemaCXX/attr-print.cpp [new file with mode: 0644]
clang/test/SemaCXX/cxx11-attr-print.cpp [new file with mode: 0644]
clang/utils/TableGen/ClangAttrEmitter.cpp
clang/utils/TableGen/TableGen.cpp
clang/utils/TableGen/TableGenBackends.h