1 // RUN: %clang_cc1 -x objective-c -emit-llvm -triple x86_64-apple-macosx10.10.0 -fsanitize=nonnull-attribute %s -o - -w | FileCheck %s
5 -(void) one_arg: (__attribute__((nonnull)) int *) arg1;
7 -(void) varargs: (__attribute__((nonnull)) int *) arg1, ...;
9 +(void) clsmethod: (__attribute__((nonnull)) int *) arg1;
15 // CHECK-LABEL: define internal void @"\01-[A one_arg:]"
16 // CHECK-SAME: ptr noundef nonnull
17 -(void) one_arg: (__attribute__((nonnull)) int *) arg1 {}
19 // CHECK-LABEL: define internal void @"\01-[A varargs:]"
20 // CHECK-SAME: ptr noundef nonnull
21 -(void) varargs: (__attribute__((nonnull)) int *) arg1, ... {}
23 // CHECK-LABEL: define internal void @"\01+[A clsmethod:]"
24 // CHECK-SAME: ptr noundef nonnull
25 +(void) clsmethod: (__attribute__((nonnull)) int *) arg1 {}
29 // CHECK-LABEL: define{{.*}} void @call_A
30 void call_A(A *a, int *p) {
31 // CHECK: [[ICMP:%.*]] = icmp ne ptr [[P1:%.*]], null, !nosanitize
32 // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize
33 // CHECK: call void @__ubsan_handle_nonnull_arg{{.*}} !nosanitize
34 // CHECK: call void @objc_msgSend({{.*}}, ptr noundef [[P1]])
37 // CHECK: [[ICMP:%.*]] = icmp ne ptr [[P2:%.*]], null, !nosanitize
38 // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize
39 // CHECK: call void @__ubsan_handle_nonnull_arg{{.*}} !nosanitize
40 // CHECK: call void (ptr, ptr, ptr, ...) @objc_msgSend({{.*}}, ptr noundef [[P2]], {{.*}})
43 // CHECK: [[ICMP:%.*]] = icmp ne ptr [[P3:%.*]], null, !nosanitize
44 // CHECK: br i1 [[ICMP]], {{.*}}, !nosanitize
45 // CHECK: call void @__ubsan_handle_nonnull_arg{{.*}} !nosanitize
46 // CHECK: call void @objc_msgSend({{.*}}, ptr noundef [[P3]])