1 // RUN: %clang_profgen -g -fcoverage-mapping -c -o %t1.o %s -DOBJECT_1
2 // RUN: %clang_profgen -g -fcoverage-mapping -c -o %t2.o %s
3 // RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe
4 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe
5 // RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s
6 
7 // Test that the instrumentation puts the right linkage on the profile data for
8 // inline functions.
9 
10 // CHECK:  {{.*}}foo{{.*}}:
11 // CHECK-NEXT:    Hash:
12 // CHECK-NEXT:    Counters: 1
13 // CHECK-NEXT:    Function count: 1
14 // CHECK:  {{.*}}inline_wrapper{{.*}}:
15 // CHECK-NEXT:    Hash:
16 // CHECK-NEXT:    Counters: 1
17 // CHECK-NEXT:    Function count: 2
18 // CHECK:  main:
19 // CHECK-NEXT:    Hash:
20 // CHECK-NEXT:    Counters: 1
21 // CHECK-NEXT:    Function count: 1
22 
23 extern "C" int puts(const char *);
24 
25 inline void inline_wrapper(const char *msg) {
26   puts(msg);
27 }
28 
29 void foo();
30 
31 #ifdef OBJECT_1
32 void foo() {
33   inline_wrapper("foo");
34 }
35 #else
36 int main() {
37   inline_wrapper("main");
38   foo();
39 }
40 #endif
41