1 /// Test instrumentation can handle various linkages.
2 // RUN: %clang_profgen -fcoverage-mapping %s -o %t
3 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
4 // RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s
6 // RUN: %clang_profgen -fcoverage-mapping -Wl,-dead_strip %s -o %t
7 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
8 // RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s
10 // CHECK: {{.*}}external{{.*}}:
12 // CHECK-NEXT: Counters: 1
13 // CHECK-NEXT: Function count: 1
14 // CHECK: {{.*}}weak{{.*}}:
16 // CHECK-NEXT: Counters: 1
17 // CHECK-NEXT: Function count: 1
20 // CHECK-NEXT: Counters: 1
21 // CHECK-NEXT: Function count: 1
22 // CHECK: {{.*}}internal{{.*}}:
24 // CHECK-NEXT: Counters: 1
25 // CHECK-NEXT: Function count: 1
26 // CHECK: {{.*}}linkonce_odr{{.*}}:
28 // CHECK-NEXT: Counters: 1
29 // CHECK-NEXT: Function count: 1
34 __attribute__((weak
)) void discarded1() {}
36 void external() { puts("external"); }
37 __attribute__((weak
)) void weak() { puts("weak"); }
38 static void internal() { puts("internal"); }
39 __attribute__((noinline
)) inline void linkonce_odr() { puts("linkonce_odr"); }