xref: /aosp_15_r20/external/clang/test/CodeGenCXX/instrument-functions.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -S -emit-llvm -triple %itanium_abi_triple -o - %s -finstrument-functions | FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li // CHECK: @_Z5test1i
test1(int x)4*67e74705SXin Li int test1(int x) {
5*67e74705SXin Li // CHECK: __cyg_profile_func_enter
6*67e74705SXin Li // CHECK: __cyg_profile_func_exit
7*67e74705SXin Li // CHECK: ret
8*67e74705SXin Li   return x;
9*67e74705SXin Li }
10*67e74705SXin Li 
11*67e74705SXin Li // CHECK: @_Z5test2i
12*67e74705SXin Li int test2(int) __attribute__((no_instrument_function));
test2(int x)13*67e74705SXin Li int test2(int x) {
14*67e74705SXin Li // CHECK-NOT: __cyg_profile_func_enter
15*67e74705SXin Li // CHECK-NOT: __cyg_profile_func_exit
16*67e74705SXin Li // CHECK: ret
17*67e74705SXin Li   return x;
18*67e74705SXin Li }
19*67e74705SXin Li 
20*67e74705SXin Li // This test case previously crashed code generation.  It exists solely
21*67e74705SXin Li // to test -finstrument-function does not crash codegen for this trivial
22*67e74705SXin Li // case.
23*67e74705SXin Li namespace rdar9445102 {
24*67e74705SXin Li   class Rdar9445102 {
25*67e74705SXin Li     public:
26*67e74705SXin Li       Rdar9445102();
27*67e74705SXin Li   };
28*67e74705SXin Li }
29*67e74705SXin Li static rdar9445102::Rdar9445102 s_rdar9445102Initializer;
30*67e74705SXin Li 
31