xref: /llvm-project/clang/test/CodeGen/ptrauth-weak_import.c (revision e23250ecb7e09170e584db60375100790f39fac9)
1 // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s  -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s  -o - | FileCheck %s
3 
4 extern void foo() __attribute__((weak_import));
5 
6 // CHECK: define {{(dso_local )?}}void @bar()
7 // CHECK: [[TMP1:%.*]] =  icmp ne ptr ptrauth (ptr @foo, i32 0), null
8 // CHECK: br i1 [[TMP1]], label
bar()9 void bar() {
10   if (foo)
11     foo();
12 }
13