[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / ubsan-nullability-assign.cpp
blob08c7f0090220ee7ba74961f7bf22c9d2268bf096
1 // RUN: %clang_cc1 -x c++ -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fsanitize=nullability-assign | FileCheck %s
3 struct S1 {
4 int *_Nonnull p;
5 };
7 struct S2 {
8 S1 s1;
9 };
11 union U1 {
12 S1 s1;
13 S2 s2;
16 // CHECK-LABEL: define{{.*}} void @{{.*}}f1
17 void f1(int *p) {
18 U1 u;
20 // CHECK: [[ICMP:%.*]] = icmp ne ptr {{.*}}, null, !nosanitize
21 // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize
22 // CHECK: call void @__ubsan_handle_type_mismatch{{.*}} !nosanitize
23 // CHECK: store
24 u.s1.p = p;
26 // CHECK: [[ICMP:%.*]] = icmp ne ptr {{.*}}, null, !nosanitize
27 // CHECK-NEXT: br i1 [[ICMP]], {{.*}}, !nosanitize
28 // CHECK: call void @__ubsan_handle_type_mismatch{{.*}} !nosanitize
29 // CHECK: store
30 u.s2.s1.p = p;
32 // CHECK-NOT: __ubsan_handle_type_mismatch
33 // CHECK-NOT: store
34 // CHECK: ret void