brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 6a79fd0 Raw
33 lines · plain
1; RUN: opt < %s -passes=dfsan -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s2target triple = "x86_64-unknown-linux-gnu"3 4; Declare custom functions.  Inputs/abilist.txt causes any function with a5; name matching /custom.*/ to be a custom function.6declare i32 @custom_fun_one_callback(ptr %callback_arg)7declare i32 @custom_fun_two_callbacks(8  ptr %callback_arg1,9  i64 %an_int,10  ptr %callback_arg211)12 13declare i8 @a_callback_fun(i32, double)14 15; CHECK-LABEL: @call_custom_funs_with_callbacks.dfsan16define void @call_custom_funs_with_callbacks(ptr %callback_arg) {17  ;; The callback should have attribute 'nonnull':18  ; CHECK: call signext i32 @__dfsw_custom_fun_one_callback(19  %call1 = call signext i32 @custom_fun_one_callback(20    ptr nonnull @a_callback_fun21  )22 23  ;; Call a custom function with two callbacks.  Check their annotations.24  ; CHECK: call i32 @__dfsw_custom_fun_two_callbacks(25  ; CHECK: i64 1234526  %call2 = call i32 @custom_fun_two_callbacks(27    ptr nonnull @a_callback_fun,28    i64 12345,29    ptr noalias @a_callback_fun30  )31  ret void32}33