]> granicus.if.org Git - clang/commit
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)
commit51d8c52ad36129760eaa586f85176037e2cd0d0e
tree0e8a5b0a948cffc4b8a68349b6dac688a466ce53
parent68bb7a6b1febbb96a60eef4e541a657c414bfda8
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173358 91177308-0d34-0410-b5e6-96231b3b80d8
16 files changed:
include/clang/AST/Attr.h
include/clang/Sema/AttributeList.h
include/clang/Sema/CMakeLists.txt
include/clang/Sema/Makefile
include/clang/Sema/Sema.h
lib/Sema/AttributeList.cpp
lib/Sema/CMakeLists.txt
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/TargetAttributesSema.cpp
test/Sema/attr-print.c [new file with mode: 0644]
test/SemaCXX/attr-print.cpp [new file with mode: 0644]
test/SemaCXX/cxx11-attr-print.cpp [new file with mode: 0644]
utils/TableGen/ClangAttrEmitter.cpp
utils/TableGen/TableGen.cpp
utils/TableGen/TableGenBackends.h