xref: /llvm-project/clang/test/CodeGen/instrument-functions.c (revision 0d501f38f348cf046d40c9baee12f0c5145b6d8c)
1 // RUN: %clang_cc1 -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions -disable-llvm-passes | FileCheck %s
2 // RUN: %clang_cc1 -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-function-entry-bare -disable-llvm-passes | FileCheck -check-prefix=BARE %s
3 
test1(int x)4 int test1(int x) {
5 // CHECK: @test1(i32 {{.*}}%x) #[[ATTR1:[0-9]+]]
6 // CHECK: ret
7 
8 // BARE: @test1(i32 {{.*}}%x) #[[ATTR1:[0-9]+]]
9 // BARE: ret
10   return x;
11 }
12 
13 int test2(int) __attribute__((no_instrument_function));
test2(int x)14 int test2(int x) {
15 // CHECK: @test2(i32 {{.*}}%x) #[[ATTR2:[0-9]+]]
16 // CHECK: ret
17 
18 // BARE: @test2(i32 {{.*}}%x) #[[ATTR2:[0-9]+]]
19 // BARE: ret
20   return x;
21 }
22 
23 // CHECK: attributes #[[ATTR1]] =
24 // CHECK-SAME: "instrument-function-entry"="__cyg_profile_func_enter"
25 // CHECK-SAME: "instrument-function-exit"="__cyg_profile_func_exit"
26 
27 // BARE: attributes #[[ATTR1]] =
28 // BARE-SAME: "instrument-function-entry-inlined"="__cyg_profile_func_enter_bare"
29 
30 // CHECK: attributes #[[ATTR2]] =
31 // CHECK-NOT: "instrument-function-entry"
32 
33 // BARE: attributes #[[ATTR2]] =
34 // BARE-NOT: "instrument-function-entry"
35