r217784 - Pretty print attributes associated with record declarations.
Aaron Ballman
aaron at aaronballman.com
Mon Sep 15 09:45:30 PDT 2014
Author: aaronballman
Date: Mon Sep 15 11:45:30 2014
New Revision: 217784
URL: http://llvm.org/viewvc/llvm-project?rev=217784&view=rev
Log:
Pretty print attributes associated with record declarations.
Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/Sema/ast-print.c
cfe/trunk/test/SemaCXX/ast-print.cpp
cfe/trunk/test/SemaCXX/attr-print.cpp
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=217784&r1=217783&r2=217784&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Mon Sep 15 11:45:30 2014
@@ -377,6 +377,9 @@ void DeclPrinter::VisitRecordDecl(Record
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(CXX
if (!Policy.SuppressSpecifiers && D->isModulePrivate())
Out << "__module_private__ ";
Out << D->getKindName();
+
+ prettyPrintAttributes(D);
+
if (D->getIdentifier())
Out << ' ' << *D;
Modified: cfe/trunk/test/Sema/ast-print.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ast-print.c?rev=217784&r1=217783&r2=217784&view=diff
==============================================================================
--- cfe/trunk/test/Sema/ast-print.c (original)
+++ cfe/trunk/test/Sema/ast-print.c Mon Sep 15 11:45:30 2014
@@ -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;
Modified: cfe/trunk/test/SemaCXX/ast-print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ast-print.cpp?rev=217784&r1=217783&r2=217784&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/ast-print.cpp Mon Sep 15 11:45:30 2014
@@ -208,3 +208,8 @@ void test(int i) {
}
}
}
+
+namespace {
+// CHECK: struct {{\[\[gnu::visibility\(\"hidden\"\)\]\]}} S;
+struct [[gnu::visibility("hidden")]] S;
+}
Modified: cfe/trunk/test/SemaCXX/attr-print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-print.cpp?rev=217784&r1=217783&r2=217784&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-print.cpp Mon Sep 15 11:45:30 2014
@@ -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")));
More information about the cfe-commits
mailing list