1 // RUN: %clang_cc1 -triple x86_64-pc-linux -std=c++11 -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s
4 __attribute__((unused));
5 // CHECK: VarDecl{{.*}}TestLocation
6 // CHECK-NEXT: UnusedAttr 0x{{[^ ]*}} <line:[[@LINE-2]]:16>
9 __attribute__((unused));
10 // CHECK: {{^}}VarDecl{{.*TestIndent[^()]*$}}
11 // CHECK-NEXT: {{^}}`-UnusedAttr{{[^()]*$}}
13 void TestAttributedStmt() {
16 [[clang::fallthrough]];
21 // CHECK: FunctionDecl{{.*}}TestAttributedStmt
22 // CHECK: AttributedStmt
23 // CHECK-NEXT: FallThroughAttr
24 // CHECK-NEXT: NullStmt
26 [[clang::warn_unused_result]] int TestCXX11DeclAttr();
27 // CHECK: FunctionDecl{{.*}}TestCXX11DeclAttr
28 // CHECK-NEXT: WarnUnusedResultAttr
30 int TestAlignedNull __attribute__((aligned));
31 // CHECK: VarDecl{{.*}}TestAlignedNull
32 // CHECK-NEXT: AlignedAttr
33 // CHECK-NEXT: <<<NULL>>>
35 int TestAlignedExpr __attribute__((aligned(4)));
36 // CHECK: VarDecl{{.*}}TestAlignedExpr
37 // CHECK-NEXT: AlignedAttr
38 // CHECK-NEXT: IntegerLiteral
40 int TestEnum __attribute__((visibility("default")));
41 // CHECK: VarDecl{{.*}}TestEnum
42 // CHECK-NEXT: VisibilityAttr{{.*}} Default
44 class __attribute__((lockable)) Mutex {
46 int TestExpr __attribute__((guarded_by(mu1)));
47 // CHECK: VarDecl{{.*}}TestExpr
48 // CHECK-NEXT: GuardedByAttr
49 // CHECK-NEXT: DeclRefExpr{{.*}}mu1
51 class Mutex TestVariadicExpr __attribute__((acquired_after(mu1, mu2)));
52 // CHECK: VarDecl{{.*}}TestVariadicExpr
53 // CHECK: AcquiredAfterAttr
54 // CHECK-NEXT: DeclRefExpr{{.*}}mu1
55 // CHECK-NEXT: DeclRefExpr{{.*}}mu2
57 void function1(void *) {
58 int TestFunction __attribute__((cleanup(function1)));
60 // CHECK: VarDecl{{.*}}TestFunction
61 // CHECK-NEXT: CleanupAttr{{.*}} Function{{.*}}function1
63 void TestIdentifier(void *, int)
64 __attribute__((pointer_with_type_tag(ident1,1,2)));
65 // CHECK: FunctionDecl{{.*}}TestIdentifier
66 // CHECK: ArgumentWithTypeTagAttr{{.*}} ident1
68 void TestBool(void *, int)
69 __attribute__((pointer_with_type_tag(bool1,1,2)));
70 // CHECK: FunctionDecl{{.*}}TestBool
71 // CHECK: ArgumentWithTypeTagAttr{{.*}} IsPointer
73 void TestUnsigned(void *, int)
74 __attribute__((pointer_with_type_tag(unsigned1,1,2)));
75 // CHECK: FunctionDecl{{.*}}TestUnsigned
76 // CHECK: ArgumentWithTypeTagAttr{{.*}} 0 1
78 void TestInt(void) __attribute__((constructor(123)));
79 // CHECK: FunctionDecl{{.*}}TestInt
80 // CHECK-NEXT: ConstructorAttr{{.*}} 123
82 int TestString __attribute__((alias("alias1")));
83 // CHECK: VarDecl{{.*}}TestString
84 // CHECK-NEXT: AliasAttr{{.*}} "alias1"
86 extern struct s1 TestType
87 __attribute__((type_tag_for_datatype(ident1,int)));
88 // CHECK: VarDecl{{.*}}TestType
89 // CHECK-NEXT: TypeTagForDatatypeAttr{{.*}} int
91 void *TestVariadicUnsigned1(int) __attribute__((alloc_size(1)));
92 // CHECK: FunctionDecl{{.*}}TestVariadicUnsigned1
93 // CHECK: AllocSizeAttr{{.*}} 0
95 void *TestVariadicUnsigned2(int, int) __attribute__((alloc_size(1,2)));
96 // CHECK: FunctionDecl{{.*}}TestVariadicUnsigned2
97 // CHECK: AllocSizeAttr{{.*}} 0 1
100 L: __attribute__((unused)) int i;
101 // CHECK: LabelStmt{{.*}}'L'
102 // CHECK: VarDecl{{.*}}i 'int'
103 // CHECK-NEXT: UnusedAttr{{.*}}
105 M: __attribute(()) int j;
106 // CHECK: LabelStmt {{.*}} 'M'
107 // CHECK-NEXT: DeclStmt
108 // CHECK-NEXT: VarDecl {{.*}} j 'int'
111 // CHECK: LabelStmt {{.*}} 'N'
112 // CHECK-NEXT: NullStmt