]> granicus.if.org Git - clang/commitdiff
Pretty print attributes associated with record declarations.
authorAaron Ballman <aaron@aaronballman.com>
Mon, 15 Sep 2014 16:45:30 +0000 (16:45 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Mon, 15 Sep 2014 16:45:30 +0000 (16:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217784 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclPrinter.cpp
test/Sema/ast-print.c
test/SemaCXX/ast-print.cpp
test/SemaCXX/attr-print.cpp

index 160e48b6d95bdfefbd639224d2c73116b15ea12b..bfd090ae20d5e21cf11b34ac403047a1849c0d8b 100644 (file)
@@ -377,6 +377,9 @@ void DeclPrinter::VisitRecordDecl(RecordDecl *D) {
   if (!Policy.SuppressSpecifiers && D->isModulePrivate())
     Out << "__module_private__ ";
   Out << D->getKindName();
+
+  prettyPrintAttributes(D);
+
   if (D->getIdentifier())
     Out << ' ' << *D;
 
@@ -768,6 +771,9 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
   if (!Policy.SuppressSpecifiers && D->isModulePrivate())
     Out << "__module_private__ ";
   Out << D->getKindName();
+
+  prettyPrintAttributes(D);
+
   if (D->getIdentifier())
     Out << ' ' << *D;
 
index 8ac4960b1191a5d43bf149032f2f8dee37a6de9c..4b2b43190d42425df18984c1b9e6c3d747ab27d9 100644 (file)
@@ -42,3 +42,6 @@ int rvarr(int n, int a[restrict static n]) {
 typedef struct {
   int f;
 } T __attribute__ ((__aligned__));
+
+// CHECK: struct __attribute__((visibility("default"))) S;
+struct __attribute__((visibility("default"))) S;
index 4851571283f4a3673547fef0efab977dc912a109..baece3c2b320f201381afc9fbdaee1d8a9fa7a8b 100644 (file)
@@ -208,3 +208,8 @@ void test(int i) {
   }
 }
 }
+
+namespace {
+// CHECK: struct {{\[\[gnu::visibility\(\"hidden\"\)\]\]}} S;
+struct [[gnu::visibility("hidden")]] S;
+}
index c430aeacfb715435397486d6360f7d0a4585d475..337a6fb69ba3c3c8d98c30c87f0bd991910f83ef 100644 (file)
@@ -26,7 +26,7 @@ int small __attribute__((mode(byte)));
 // CHECK: int v __attribute__((visibility("hidden")));
 int v __attribute__((visibility("hidden")));
 
-// FIXME: The attribute should be printed with the tag declaration.
+// CHECK: class __attribute__((consumable("unknown"))) AttrTester1
 class __attribute__((consumable(unknown))) AttrTester1 {
   // CHECK: void callableWhen() __attribute__((callable_when("unconsumed", "consumed")));
   void callableWhen()  __attribute__((callable_when("unconsumed", "consumed")));