[libc][test] Adjust header paths in tests (#119623)
[llvm-project.git] / clang / test / CXX / drs / cwg158.cpp
blob2a744382647773a080bce3a43624e29427fc7633
1 // RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s
2 // RUN: %clang_cc1 -triple x86_64-linux -std=c++11 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s
3 // RUN: %clang_cc1 -triple x86_64-linux -std=c++14 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s
4 // RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s
5 // RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -pointer-tbaa -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK,POINTER-TBAA %s
7 // cwg158: yes
9 // CHECK-LABEL: define {{.*}} @_Z1f
10 const int *f(const int * const *p, int **q) {
11 // CHECK: load ptr, ptr %p.addr
12 // CHECK: load ptr, {{.*}}, !tbaa ![[INTPTR_TBAA:[^,]*]]
13 const int *x = *p;
14 // CHECK: store ptr null, {{.*}}, !tbaa ![[INTPTR_TBAA]]
15 *q = 0;
16 return x;
19 struct A {};
21 // CHECK-LABEL: define {{.*}} @_Z1g
22 const int *(A::*const *g(const int *(A::* const **p)[3], int *(A::***q)[3]))[3] {
23 // CHECK: load ptr, ptr %p.addr
24 // CHECK: load ptr, {{.*}}, !tbaa ![[MEMPTR_TBAA:[^,]*]]
25 const int *(A::*const *x)[3] = *p;
26 // CHECK: store ptr null, {{.*}}, !tbaa ![[MEMPTR_TBAA]]
27 *q = 0;
28 return x;
31 // CHECK-LABEL: define {{.*}} @_Z1h
32 const int * h(const int * (*p)[10], int *(*q)[9]) {
33 // CHECK: load ptr, ptr %p.addr, align 8, !tbaa [[PTRARRAY_TBAA:!.+]]
34 const int * x = *p[0];
36 // CHECK: load ptr, ptr %q.addr, align 8, !tbaa [[PTRARRAY_TBAA]]
37 *q[0] = 0;
38 return x;
41 // POINTER-TBAA: [[PTRARRAY_TBAA]] = !{[[PTRARRAY_TY:!.+]], [[PTRARRAY_TY]], i64 0}
42 // POINTER-TBAA: [[PTRARRAY_TY]] = !{!"p2 int", [[ANYPTR:!.+]], i64 0}
43 // POINTER-TBAA: [[ANYPTR]] = !{!"any pointer"