[profile] Add -fprofile-instr-generate tests for weak definition and various linkages
This commit is contained in:
parent
ba04c7c128
commit
b19c0ac7dd
|
|
@ -0,0 +1,8 @@
|
|||
// REQUIRES: lld-available
|
||||
/// With lld --gc-sections we can ensure discarded[01] and their profc/profd
|
||||
/// variables are discarded.
|
||||
|
||||
// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -fuse-ld=lld -Wl,--gc-sections %S/coverage-linkage.cpp -o %t
|
||||
// RUN: llvm-nm %t | FileCheck %s
|
||||
|
||||
// CHECK-NOT: discarded{{.*}}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/// Test instrumentation can handle various linkages.
|
||||
// RUN: %clang_profgen -fcoverage-mapping %s -o %t
|
||||
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
|
||||
|
||||
// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -Wl,--gc-sections %s -o %t
|
||||
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void discarded0() {}
|
||||
__attribute__((weak)) void discarded1() {}
|
||||
|
||||
void external() { puts("external"); }
|
||||
__attribute__((weak)) void weak() { puts("weak"); }
|
||||
static void internal() { puts("internal"); }
|
||||
__attribute__((noinline)) inline void linkonce_odr() { puts("linkonce_odr"); }
|
||||
|
||||
int main() {
|
||||
internal();
|
||||
external();
|
||||
weak();
|
||||
linkonce_odr();
|
||||
}
|
||||
Loading…
Reference in New Issue