xref: /aosp_15_r20/external/compiler-rt/test/profile/instrprof-visibility.cpp (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot // RUN: %clangxx_profgen -fcoverage-mapping %S/Inputs/instrprof-visibility-helper.cpp -o %t %s
2*7c3d14c8STreehugger Robot // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
3*7c3d14c8STreehugger Robot // RUN: llvm-profdata merge %t.profraw -o %t.profdata
4*7c3d14c8STreehugger Robot // RUN: llvm-profdata show --all-functions %t.profraw | FileCheck %s --check-prefix=PROFILE
5*7c3d14c8STreehugger Robot // RUN: llvm-cov show %t -instr-profile=%t.profdata | FileCheck %s --check-prefix=COV
6*7c3d14c8STreehugger Robot 
7*7c3d14c8STreehugger Robot namespace {
8*7c3d14c8STreehugger Robot #define NO_WEAK
9*7c3d14c8STreehugger Robot #define NO_EXTERN
10*7c3d14c8STreehugger Robot #include "instrprof-visibility-kinds.inc"
11*7c3d14c8STreehugger Robot #undef NO_EXTERN
12*7c3d14c8STreehugger Robot #undef NO_WEAK
13*7c3d14c8STreehugger Robot }
14*7c3d14c8STreehugger Robot 
15*7c3d14c8STreehugger Robot namespace N1 {
16*7c3d14c8STreehugger Robot #include "instrprof-visibility-kinds.inc"
17*7c3d14c8STreehugger Robot }
18*7c3d14c8STreehugger Robot 
main()19*7c3d14c8STreehugger Robot int main() {
20*7c3d14c8STreehugger Robot   call();
21*7c3d14c8STreehugger Robot   N1::call();
22*7c3d14c8STreehugger Robot   return 0;
23*7c3d14c8STreehugger Robot }
24*7c3d14c8STreehugger Robot 
25*7c3d14c8STreehugger Robot // PROFILE-DAG: _ZN2N12f1Ev
26*7c3d14c8STreehugger Robot // PROFILE-DAG: _ZN2N12f2Ev
27*7c3d14c8STreehugger Robot // PROFILE-DAG: _ZN2N12f3Ev
28*7c3d14c8STreehugger Robot // PROFILE-DAG: _ZN2N12f4Ev
29*7c3d14c8STreehugger Robot // PROFILE-DAG: _ZN2N12f5Ev
30*7c3d14c8STreehugger Robot // PROFILE-DAG: _ZN2N12f6Ev
31*7c3d14c8STreehugger Robot // PROFILE-DAG: _ZN2N12f7Ev
32*7c3d14c8STreehugger Robot // PROFILE-DAG: _ZN2N14callEv
33*7c3d14c8STreehugger Robot // PROFILE-DAG: main
34*7c3d14c8STreehugger Robot // PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_14callEv
35*7c3d14c8STreehugger Robot // PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f1Ev
36*7c3d14c8STreehugger Robot // PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f3Ev
37*7c3d14c8STreehugger Robot // PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f5Ev
38*7c3d14c8STreehugger Robot // PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f6Ev
39*7c3d14c8STreehugger Robot // PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f7Ev
40*7c3d14c8STreehugger Robot // PROFILE-DAG: Total functions: 15
41*7c3d14c8STreehugger Robot 
42*7c3d14c8STreehugger Robot // COV-DAG: instrprof-visibility-helper.cpp
43*7c3d14c8STreehugger Robot 
44*7c3d14c8STreehugger Robot // COV-DAG: instrprof-visibility-kinds.inc
45*7c3d14c8STreehugger Robot 
46*7c3d14c8STreehugger Robot // COV-DAG: _ZN2N12f1Ev
47*7c3d14c8STreehugger Robot // COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f1Ev
48*7c3d14c8STreehugger Robot // COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f3Ev
49*7c3d14c8STreehugger Robot // COV-DAG: _ZN2N12f3Ev
50*7c3d14c8STreehugger Robot // COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f5Ev
51*7c3d14c8STreehugger Robot // COV-DAG: _ZN2N12f5Ev
52*7c3d14c8STreehugger Robot // COV-DAG: _ZN2N12f6Ev
53*7c3d14c8STreehugger Robot // COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f6Ev
54*7c3d14c8STreehugger Robot // COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f7Ev
55*7c3d14c8STreehugger Robot // COV-DAG: _ZN2N12f7Ev
56*7c3d14c8STreehugger Robot 
57*7c3d14c8STreehugger Robot // --- Check coverage for functions in the anonymous namespace.
58*7c3d14c8STreehugger Robot // COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_14callEv
59*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|void call() {
60*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f1();
61*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|#ifndef NO_WEAK
62*7c3d14c8STreehugger Robot // COV-DAG:  |{{.*}}|  f2();
63*7c3d14c8STreehugger Robot // COV-DAG:  |{{.*}}|#endif
64*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f3();
65*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|#ifndef NO_EXTERN
66*7c3d14c8STreehugger Robot // COV-DAG:  |{{.*}}|  f4();
67*7c3d14c8STreehugger Robot // COV-DAG:  |{{.*}}|#endif
68*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f5();
69*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f6();
70*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f7();
71*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|}
72*7c3d14c8STreehugger Robot 
73*7c3d14c8STreehugger Robot // --- Check coverage for functions in namespace N1.
74*7c3d14c8STreehugger Robot // COV-DAG: _ZN2N14callEv
75*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|void call() {
76*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f1();
77*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|#ifndef NO_WEAK
78*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f2();
79*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|#endif
80*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f3();
81*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|#ifndef NO_EXTERN
82*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f4();
83*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|#endif
84*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f5();
85*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f6();
86*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|  f7();
87*7c3d14c8STreehugger Robot // COV-DAG: 1|{{.*}}|}
88*7c3d14c8STreehugger Robot 
89*7c3d14c8STreehugger Robot // COV-DAG: instrprof-visibility.cpp
90