summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/code-coverage.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-04-08 18:45:10 +0000
committerdim <dim@FreeBSD.org>2013-04-08 18:45:10 +0000
commitc72c57c9e9b69944e3e009cd5e209634839581d3 (patch)
tree4fc2f184c499d106f29a386c452b49e5197bf63d /test/CodeGen/code-coverage.c
parent5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff)
downloadFreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip
FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/CodeGen/code-coverage.c')
-rw-r--r--test/CodeGen/code-coverage.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/CodeGen/code-coverage.c b/test/CodeGen/code-coverage.c
new file mode 100644
index 0000000..1b87d64
--- /dev/null
+++ b/test/CodeGen/code-coverage.c
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data -coverage-no-function-names-in-data %s -o - | FileCheck %s --check-prefix WITHOUTNAMES
+
+// <rdar://problem/12843084>
+
+int test1(int a) {
+ switch (a % 2) {
+ case 0:
+ ++a;
+ case 1:
+ a /= 2;
+ }
+ return a;
+}
+
+// Check that the noredzone flag is set on the generated functions.
+
+// CHECK: void @__llvm_gcov_indirect_counter_increment(i32* %{{.*}}, i64** %{{.*}}) unnamed_addr [[NRZ:#[0-9]+]]
+
+// Inside llvm_gcov_writeout, check that -coverage-no-function-names-in-data
+// passes null as the function name.
+// CHECK: void @__llvm_gcov_writeout() unnamed_addr [[NRZ]]
+// CHECK: call void @llvm_gcda_emit_function({{.*}}, i8* getelementptr {{.*}}, {{.*}})
+// WITHOUTNAMES: void @__llvm_gcov_writeout() unnamed_addr
+// WITHOUTNAMES: call void @llvm_gcda_emit_function({{.*}}, i8* null, {{.*}})
+
+// CHECK: void @__llvm_gcov_flush() unnamed_addr [[NRZ]]
+// CHECK: void @__llvm_gcov_init() unnamed_addr [[NRZ]]
+
+// CHECK: attributes [[NRZ]] = { {{.*}}noredzone{{.*}} }
OpenPOWER on IntegriCloud