[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / AST / ast-dump-APValue-vector.cpp
bloba9ec1d361c4128a7ff6acc7d27337b66e1fb50fa
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 void Test() {
14 constexpr int __attribute__((vector_size(sizeof(int) * 1))) v1i = {1};
15 // CHECK: |-DeclStmt {{.*}} <line:{{.*}}, col:{{.*}}>
16 // CHECK-NEXT: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} v1i '__attribute__((__vector_size__(1 * sizeof(int)))) int const' constexpr cinit
17 // CHECK-NEXT: | |-value: Vector length=1
18 // CHECK-NEXT: | | `-element: Int 1
20 constexpr int __attribute__((vector_size(sizeof(int) * 4))) v4i = {1, 2, 3, 4};
21 // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} v4i '__attribute__((__vector_size__(4 * sizeof(int)))) int const' constexpr cinit
22 // CHECK-NEXT: | |-value: Vector length=4
23 // CHECK-NEXT: | | `-elements: Int 1, Int 2, Int 3, Int 4
25 constexpr int __attribute__((vector_size(sizeof(int) * 5))) v5i = {1, 2, 3, 4};
26 // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} v5i '__attribute__((__vector_size__(5 * sizeof(int)))) int const' constexpr cinit
27 // CHECK-NEXT: | |-value: Vector length=5
28 // CHECK-NEXT: | | |-elements: Int 1, Int 2, Int 3, Int 4
29 // CHECK-NEXT: | | `-element: Int 0
31 constexpr int __attribute__((vector_size(sizeof(int) * 8))) v8i = {1, 2, 3, 4};
32 // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} v8i '__attribute__((__vector_size__(8 * sizeof(int)))) int const' constexpr cinit
33 // CHECK-NEXT: | |-value: Vector length=8
34 // CHECK-NEXT: | | |-elements: Int 1, Int 2, Int 3, Int 4
35 // CHECK-NEXT: | | `-elements: Int 0, Int 0, Int 0, Int 0
37 constexpr int __attribute__((vector_size(sizeof(int) * 9))) v9i = {1, 2, 3, 4};
38 // CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} v9i '__attribute__((__vector_size__(9 * sizeof(int)))) int const' constexpr cinit
39 // CHECK-NEXT: |-value: Vector length=9
40 // CHECK-NEXT: | |-elements: Int 1, Int 2, Int 3, Int 4
41 // CHECK-NEXT: | |-elements: Int 0, Int 0, Int 0, Int 0
42 // CHECK-NEXT: | `-element: Int 0