From 830605fd9a90c933da058be4003da58b7b760e7e Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Wed, 11 Feb 2015 02:53:03 +0000 Subject: [PATCH] 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: https://llvm.org/svn/llvm-project/cfe/trunk@228794 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CoverageMapping/unused_names.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/CoverageMapping/unused_names.c b/test/CoverageMapping/unused_names.c index b131720961..8a57957378 100644 --- a/test/CoverageMapping/unused_names.c +++ b/test/CoverageMapping/unused_names.c @@ -1,10 +1,15 @@ -// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -emit-llvm -o - %s | FileCheck %s +// 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-NOT: @__llvm_profile_name_foo = -// CHECK: @__llvm_profile_name_bar = -// CHECK-NOT: @__llvm_profile_name_foo = +// 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 @@ -17,5 +22,7 @@ inline int foo() { return 0; } #include __FILE__ int bar() { return 0; } +inline int baz() { return 0; } +static int qux() { return 42; } #endif -- 2.50.1