[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / indirect-noundef.cpp
blob56d719f2f511ca61d3e6f2e4a00ee7c247681861
1 // RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -fsanitize-memory-param-retval -o - %s | FileCheck %s
4 // no-sanitize-memory-param-retval does NOT conflict with enable-noundef-analysis
5 // RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -fno-sanitize-memory-param-retval -o - %s | FileCheck %s
7 union u1 {
8 int val;
9 };
11 // CHECK: @indirect_callee_int_ptr = [[GLOBAL:(dso_local )?global]] ptr
12 int (*indirect_callee_int_ptr)(int);
13 // CHECK: @indirect_callee_union_ptr = [[GLOBAL]] ptr
14 union u1 (*indirect_callee_union_ptr)(union u1);
16 // CHECK: [[DEF:define( dso_local)?]] noundef i32 @{{.*}}indirect_callee_int{{.*}}(i32 noundef %
17 int indirect_callee_int(int a) { return a; }
18 // CHECK: [[DEF]] i32 @{{.*}}indirect_callee_union{{.*}}(i32 %
19 union u1 indirect_callee_union(union u1 a) {
20 return a;
23 int main() {
24 // CHECK: call noundef i32 @{{.*}}indirect_callee_int{{.*}}(i32 noundef 0)
25 indirect_callee_int(0);
26 // CHECK: call i32 @{{.*}}indirect_callee_union{{.*}}(i32 %
27 indirect_callee_union((union u1){0});
29 indirect_callee_int_ptr = indirect_callee_int;
30 indirect_callee_union_ptr = indirect_callee_union;
32 // CHECK: call noundef i32 %{{.*}}(i32 noundef 0)
33 indirect_callee_int_ptr(0);
34 // CHECK: call i32 %{{.*}}(i32 %
35 indirect_callee_union_ptr((union u1){});
37 return 0;