Pretty print attributes associated with record declarations.

llvm-svn: 217784
This commit is contained in:
Aaron Ballman 2014-09-15 16:45:30 +00:00
parent 18625ee75c
commit 5388538e87
4 changed files with 15 additions and 1 deletions

View 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;

View 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;

View File

@ -208,3 +208,8 @@ void test(int i) {
}
}
}
namespace {
// CHECK: struct {{\[\[gnu::visibility\(\"hidden\"\)\]\]}} S;
struct [[gnu::visibility("hidden")]] S;
}

View 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")));