1 // Test that the instrumentation puts the right linkage on the profile data for
3 // RUN: %clang_profgen -g -fcoverage-mapping -c -o %t1.o %s -DOBJECT_1
4 // RUN: %clang_profgen -g -fcoverage-mapping -c -o %t2.o %s
5 // RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe
6 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe
7 // RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s
9 // Again, with optimizations and inlining. This tests that we use comdats
11 // RUN: %clang_profgen -O2 -g -fcoverage-mapping -c -o %t1.o %s -DOBJECT_1
12 // RUN: %clang_profgen -O2 -g -fcoverage-mapping -c -o %t2.o %s
13 // RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe
14 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe
15 // RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s
17 // CHECK: {{.*}}foo{{.*}}:
19 // CHECK-NEXT: Counters: 1
20 // CHECK-NEXT: Function count: 1
21 // CHECK: {{.*}}inline_wrapper{{.*}}:
23 // CHECK-NEXT: Counters: 1
24 // CHECK-NEXT: Function count: 2
27 // CHECK-NEXT: Counters: 1
28 // CHECK-NEXT: Function count: 1
30 extern "C" int puts(const char *);
32 inline void inline_wrapper(const char *msg
) {
40 inline_wrapper("foo");
44 inline_wrapper("main");