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

source code of compiler-rt/test/profile/Posix/instrprof-visibility.cpp