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