[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / AST / ast-dump-APValue-union.cpp
blobb70b5ea484a6e97469f098458d0fd0a51a284cd6
1 // Test without serialization:
2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -std=gnu++17 \
3 // RUN: -ast-dump %s -ast-dump-filter Test \
4 // RUN: | FileCheck --strict-whitespace --match-full-lines %s
5 //
6 // Test with serialization:
7 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -std=gnu++17 -emit-pch -o %t %s
8 // RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -Wno-unused-value -std=gnu++17 \
9 // RUN: -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
10 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
11 // RUN: | FileCheck --strict-whitespace --match-full-lines %s
13 union U0 {
14 int i = 42;
15 float f;
18 union U1 {
19 union Uinner {
20 int i;
21 float f = 3.1415f;
22 } uinner;
25 union U2 {
26 union Uinner {
27 double d;
28 int arr[2] = {1, 2};
29 } uinner;
32 union U3 {
33 union Uinner {
34 double d = 3.1415;
35 int arr[2];
36 } uinner;
37 float f;
40 void Test() {
41 constexpr U0 u0{};
42 // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0 'const U0':'const U0' constexpr listinit
43 // CHECK-NEXT: | |-value: Union .i Int 42
45 constexpr U1 u1{};
46 // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1 'const U1':'const U1' constexpr listinit
47 // CHECK-NEXT: | |-value: Union .uinner Union .f Float 3.141500e+00
49 constexpr U2 u2{};
50 // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u2 'const U2':'const U2' constexpr listinit
51 // CHECK-NEXT: | |-value: Union .uinner
52 // CHECK-NEXT: | | `-Union .arr
53 // CHECK-NEXT: | | `-Array size=2
54 // CHECK-NEXT: | | `-elements: Int 1, Int 2
56 constexpr U3 u3a = {.f = 3.1415};
57 // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3a 'const U3':'const U3' constexpr cinit
58 // CHECK-NEXT: | |-value: Union .f Float 3.141500e+00
60 constexpr U3 u3b = {.uinner = {}};
61 // CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3b 'const U3':'const U3' constexpr cinit
62 // CHECK-NEXT: |-value: Union .uinner Union .d Float 3.141500e+00