1 // Test that the instrumentation puts the right linkage on the profile data for 2 // inline functions. 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 8 9 // Again, with optimizations and inlining. This tests that we use comdats 10 // correctly. 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 16 17 // CHECK: {{.*}}foo{{.*}}: 18 // CHECK-NEXT: Hash: 19 // CHECK-NEXT: Counters: 1 20 // CHECK-NEXT: Function count: 1 21 // CHECK: {{.*}}inline_wrapper{{.*}}: 22 // CHECK-NEXT: Hash: 23 // CHECK-NEXT: Counters: 1 24 // CHECK-NEXT: Function count: 2 25 // CHECK: main: 26 // CHECK-NEXT: Hash: 27 // CHECK-NEXT: Counters: 1 28 // CHECK-NEXT: Function count: 1 29 30 extern "C" int puts(const char *); 31 32 inline void inline_wrapper(const char *msg) { 33 puts(msg); 34 } 35 36 void foo(); 37 38 #ifdef OBJECT_1 39 void foo() { 40 inline_wrapper("foo"); 41 } 42 #else 43 int main() { 44 inline_wrapper("main"); 45 foo(); 46 } 47 #endif 48