|
| 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 |
| 12 | + |
| 13 | +int i; |
| 14 | +struct S { |
| 15 | + int i; |
| 16 | + int ii; |
| 17 | +}; |
| 18 | +S s; |
| 19 | + |
| 20 | +struct F { |
| 21 | + char padding[12]; |
| 22 | + S s; |
| 23 | +}; |
| 24 | +F f; |
| 25 | + |
| 26 | +void Test() { |
| 27 | + constexpr int *pi = &i; |
| 28 | + // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pi 'int *const' constexpr cinit |
| 29 | + // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=0, HasPath=1, PathLength=0, Path=() |
| 30 | + |
| 31 | + constexpr int *psi = &s.i; |
| 32 | + // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} psi 'int *const' constexpr cinit |
| 33 | + // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=0, HasPath=1, PathLength=1, Path=({{.*}}) |
| 34 | + |
| 35 | + constexpr int *psii = &s.ii; |
| 36 | + // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} psii 'int *const' constexpr cinit |
| 37 | + // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=4, HasPath=1, PathLength=1, Path=({{.*}}) |
| 38 | + |
| 39 | + constexpr int *pf = &f.s.ii; |
| 40 | + // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pf 'int *const' constexpr cinit |
| 41 | + // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=12, HasPath=1, PathLength=2, Path=({{.*}}, {{.*}}) |
| 42 | + |
| 43 | + constexpr char *pc = &f.padding[2]; |
| 44 | + // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pf 'char *const' constexpr cinit |
| 45 | + // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=2, HasPath=1, PathLength=2, Path=({{.*}}, 2) |
| 46 | + |
| 47 | + constexpr const int *n = nullptr; |
| 48 | + // CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} n 'const int *const' constexpr cinit |
| 49 | + // CHECK-NEXT: |-value: LValue Base=null, Null=1, Offset=0, HasPath=1, PathLength=0, Path=() |
| 50 | +} |
0 commit comments