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/test/SemaCXX/attr-print.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/test/SemaCXX/attr-print.cpp')
-rw-r--r-- | clang/test/SemaCXX/attr-print.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/attr-print.cpp b/clang/test/SemaCXX/attr-print.cpp new file mode 100644 index 00000000000..317ba4d1574 --- /dev/null +++ b/clang/test/SemaCXX/attr-print.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -ast-print | FileCheck %s + +// FIXME: align attribute print + +// CHECK: int x __attribute__((aligned(4, 0))); +int x __attribute__((aligned(4))); + +// CHECK: int y __attribute__((align(4, 0))); +int y __attribute__((align(4))); + +// CHECK: void foo() __attribute__((const)); +void foo() __attribute__((const)); + +// CHECK: void bar() __attribute__((__const)); +void bar() __attribute__((__const)); |