[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / clang / test / CodeGenCXX / ubsan-nullability-arg.cpp
blob53e324ca9effea1bb32ce7ebbc5d7033efef2e68
1 // RUN: %clang_cc1 -x c++ -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fsanitize=nullability-arg | FileCheck %s -check-prefixes=ITANIUM,ALL
2 // RUN: %clang_cc1 -x c++ -triple x86_64-pc-windows-msvc -emit-llvm -o - %s -fsanitize=nullability-arg | FileCheck %s -check-prefixes=MSVC,ALL
4 namespace method_ptr {
6 struct S0 {
7 void foo1();
8 };
10 void foo1(void (S0::*_Nonnull f)());
12 // ITANIUM-LABEL: @_ZN10method_ptr5test1Ev(){{.*}} {
13 // ITANIUM: [[CMP:%.*]] = icmp ne i64 ptrtoint (ptr @_ZN10method_ptr2S04foo1Ev to i64), 0
14 // ITANIUM: br i1 [[CMP]], label %[[CONT:.*]], label %[[FAIL:[^,]*]]
15 // ITANIUM-EMPTY:
16 // ITANIUM-NEXT: [[FAIL]]:
17 // ITANIUM-NEXT: call void @__ubsan_handle_nullability_arg
19 // MSVC-LABEL: @"?test1@method_ptr@@YAXXZ"(){{.*}} {
20 // MSVC: br i1 true, label %[[CONT:.*]], label %[[FAIL:[^,]*]]
21 // MSVC-EMPTY:
22 // MSVC-NEXT: [[FAIL]]:
23 // MSVC-NEXT: call void @__ubsan_handle_nullability_arg
24 void test1() {
25 foo1(&S0::foo1);
28 } // namespace method_ptr
30 namespace data_ptr {
32 struct S0 {
33 int field1;
36 using member_ptr = int S0::*;
38 void foo1(member_ptr _Nonnull);
40 // ITANIUM-LABEL: @_ZN8data_ptr5test1ENS_2S0E(
41 // MSVC-LABEL: @"?test1@data_ptr@@YAXUS0@1@@Z"(
42 // ALL: [[DATA_PTR_CHECK:%.*]] = icmp ne {{.*}}, -1, !nosanitize
43 // ALL-NEXT: br i1 [[DATA_PTR_CHECK]], label %[[CONT:.*]], label %[[FAIL:[^,]+]]
44 // ALL-EMPTY:
45 // ALL-NEXT: [[FAIL]]:
46 // ALL-NEXT: call void @__ubsan_handle_nullability_arg
47 void test1(S0 s) {
48 int S0::*member = &S0::field1;
49 foo1(member);
52 } // namespace data_ptr