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 
5 // RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -Wl,--gc-sections %s -o %t
6 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
7 
8 #include <stdio.h>
9 
10 void discarded0() {}
11 __attribute__((weak)) void discarded1() {}
12 
13 void external() { puts("external"); }
14 __attribute__((weak)) void weak() { puts("weak"); }
15 static void internal() { puts("internal"); }
16 __attribute__((noinline)) inline void linkonce_odr() { puts("linkonce_odr"); }
17 
18 int main() {
19   internal();
20   external();
21   weak();
22   linkonce_odr();
23 }
24