1 // Test without serialization:
2 // RUN: %clang_cc1 -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
3 // RUN: -Wno-deprecated-declarations -ast-dump -ast-dump-filter Test %s \
4 // RUN: | FileCheck --strict-whitespace %s
5 //
6 // Test with serialization:
7 // RUN: %clang_cc1 -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
8 // RUN: -Wno-deprecated-declarations -emit-pch -o %t %s
9 // RUN: %clang_cc1 -x c -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
10 // RUN: -Wno-deprecated-declarations -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
11 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
12 // RUN: | FileCheck --strict-whitespace %s
13 
14 int Test1 [[deprecated]];
15 // CHECK:      VarDecl{{.*}}Test1
16 // CHECK-NEXT:   DeprecatedAttr 0x{{[^ ]*}} <col:13> "" ""
17 
18 enum [[deprecated("Frobble")]] Test2 {
19   Test3 [[deprecated]]
20 };
21 // CHECK:      EnumDecl{{.*}}Test2
22 // CHECK-NEXT:   DeprecatedAttr 0x{{[^ ]*}} <col:8, col:28> "Frobble" ""
23 // CHECK-NEXT:   EnumConstantDecl{{.*}}Test3
24 // CHECK-NEXT:     DeprecatedAttr 0x{{[^ ]*}} <col:11> "" ""
25 
26 struct [[deprecated]] Test4 {
27   [[deprecated("Frobble")]] int Test5, Test6;
28   int Test7 [[deprecated]] : 12;
29 };
30 // CHECK:      RecordDecl{{.*}}Test4
31 // CHECK-NEXT:   DeprecatedAttr 0x{{[^ ]*}} <col:10> "" ""
32 // CHECK-NEXT:   FieldDecl{{.*}}Test5
33 // CHECK-NEXT:     DeprecatedAttr 0x{{[^ ]*}} <col:5, col:25> "Frobble" ""
34 // CHECK-NEXT:   FieldDecl{{.*}}Test6
35 // CHECK-NEXT:     DeprecatedAttr 0x{{[^ ]*}} <col:5, col:25> "Frobble" ""
36 // CHECK-NEXT:   FieldDecl{{.*}}Test7
37 // CHECK-NEXT:     Constant{{.*}}'int'
38 // CHECK-NEXT:       IntegerLiteral{{.*}}'int' 12
39 // CHECK-NEXT:     DeprecatedAttr 0x{{[^ ]*}} <col:15> "" ""
40 
41 struct [[deprecated]] Test8;
42 // CHECK:      RecordDecl{{.*}}Test8
43 // CHECK-NEXT:   DeprecatedAttr 0x{{[^ ]*}} <col:10> "" ""
44 
45 [[deprecated]] void Test9(int Test10 [[deprecated]]);
46 // CHECK:      FunctionDecl{{.*}}Test9
47 // CHECK-NEXT:   ParmVarDecl{{.*}}Test10
48 // CHECK-NEXT:     DeprecatedAttr 0x{{[^ ]*}} <col:40> "" ""
49 // CHECK-NEXT:   DeprecatedAttr 0x{{[^ ]*}} <col:3> "" ""
50 
51 void Test11 [[deprecated]](void);
52 // CHECK:      FunctionDecl{{.*}}Test11
53 // CHECK-NEXT:   DeprecatedAttr 0x{{[^ ]*}} <col:15> "" ""
54 
Test12(void)55 void Test12(void) [[deprecated]] {}
56 // CHECK:      FunctionDecl{{.*}}Test12
57 // CHECK-NEXT:   CompoundStmt
58 // CHECK-NEXT:   DeprecatedAttr 0x{{[^ ]*}} <col:21> "" ""
59