// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -emit-llvm -o - %s | FileCheck %s

// Since foo is never emitted, there should not be a profile name for it.

// CHECK-NOT: @__llvm_profile_name_foo =
// CHECK: @__llvm_profile_name_bar =
// CHECK-NOT: @__llvm_profile_name_foo =

#ifdef IS_SYSHEADER

#pragma clang system_header
inline int foo() { return 0; }

#else

#define IS_SYSHEADER
#include __FILE__

int bar() { return 0; }

#endif

// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -emit-llvm -main-file-name unused_names.c -o - %s > %t
// RUN: FileCheck -input-file %t %s
// RUN: FileCheck -check-prefix=SYSHEADER -input-file %t %s

// Since foo is never emitted, there should not be a profile name for it.

// CHECK-DAG: @__llvm_profile_name_bar = {{.*}} section "{{.*}}__llvm_prf_names"
// CHECK-DAG: @__llvm_profile_name_baz = {{.*}} section "{{.*}}__llvm_prf_names"
// CHECK-DAG: @"__llvm_profile_name_unused_names.c:qux" = {{.*}} section "{{.*}}__llvm_prf_names"

// SYSHEADER-NOT: @__llvm_profile_name_foo =


#ifdef IS_SYSHEADER

#pragma clang system_header
inline int foo() { return 0; }

#else

#define IS_SYSHEADER
#include __FILE__

int bar() { return 0; }
inline int baz() { return 0; }
static int qux() { return 42; }

#endif

Add a test for PR22531
InstrProf: Add a test for PR22531

This is a test for the llvm change in r228793. We need to make sure
that names referred to by coverage end up in the right section, or the
coverage tools won't work.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@228794 91177308-0d34-0410-b5e6-96231b3b80d8
