]> granicus.if.org Git - clang/commitdiff
InstrProf: Add a test for PR22531
authorJustin Bogner <mail@justinbogner.com>
Wed, 11 Feb 2015 02:53:03 +0000 (02:53 +0000)
committerJustin Bogner <mail@justinbogner.com>
Wed, 11 Feb 2015 02:53:03 +0000 (02:53 +0000)
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

index b1317209610a8a7710410312fd15e0575c72d0f8..8a57957378d1fb7fceb8700a351ed01029d123dc 100644 (file)
@@ -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