[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / AST / ast-dump-c-attr.c
blobc8e0d89827f802ee6007de70629a4e0b0fbcfc45
1 // Test without serialization:
2 // RUN: %clang_cc1 -triple x86_64-pc-linux \
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 \
8 // RUN: -Wno-deprecated-declarations -emit-pch -o %t %s
9 // RUN: %clang_cc1 -x c -triple x86_64-pc-linux \
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
14 int Test1 [[deprecated]];
15 // CHECK: VarDecl{{.*}}Test1
16 // CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:13> "" ""
18 enum [[deprecated("Frobble")]] Test2 {
19 Test3 [[deprecated]]
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> "" ""
26 struct [[deprecated]] Test4 {
27 [[deprecated("Frobble")]] int Test5, Test6;
28 int Test7 [[deprecated]] : 12;
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: ConstantExpr{{.*}}'int'
38 // CHECK-NEXT: value: Int 12
39 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 12
40 // CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:15> "" ""
42 struct [[deprecated]] Test8;
43 // CHECK: RecordDecl{{.*}}Test8
44 // CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:10> "" ""
46 [[deprecated]] void Test9(int Test10 [[deprecated]]);
47 // CHECK: FunctionDecl{{.*}}Test9
48 // CHECK-NEXT: ParmVarDecl{{.*}}Test10
49 // CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:40> "" ""
50 // CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:3> "" ""
52 void Test11 [[deprecated]](void);
53 // CHECK: FunctionDecl{{.*}}Test11
54 // CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:15> "" ""