summaryrefslogtreecommitdiffstats
path: root/clang/test/CoverageMapping/unused_names.c
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-01-22 02:17:23 +0000
committerJustin Bogner <mail@justinbogner.com>2015-01-22 02:17:23 +0000
commit00270df5175e97951836f4aa721d45c902f4b4ee (patch)
treeabf7afa7a53341f63a74700fc36fe0c212317fe6 /clang/test/CoverageMapping/unused_names.c
parente71fb5ce05089b9343c6cda9663c214b9c29c52e (diff)
downloadbcm5719-llvm-00270df5175e97951836f4aa721d45c902f4b4ee.tar.gz
bcm5719-llvm-00270df5175e97951836f4aa721d45c902f4b4ee.zip
InstrProf: Avoid creating profile names for symbols in system headers
We don't emit any coverage mapping for uncovered functions that come from system headers, but we were creating a GlobalVariable with each of their names. This is wasteful since the linker will need to dead strip the unused symbols, and it can lead to issues when merging coverage with others TUs that do have coverage for those functions. llvm-svn: 226764
Diffstat (limited to 'clang/test/CoverageMapping/unused_names.c')
-rw-r--r--clang/test/CoverageMapping/unused_names.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CoverageMapping/unused_names.c b/clang/test/CoverageMapping/unused_names.c
new file mode 100644
index 00000000000..b1317209610
--- /dev/null
+++ b/clang/test/CoverageMapping/unused_names.c
@@ -0,0 +1,21 @@
+// 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
OpenPOWER on IntegriCloud