summaryrefslogtreecommitdiffstats
path: root/clang/test/CoverageMapping/preprocessor.c
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2014-08-19 17:32:30 +0000
committerAlex Lorenz <arphaman@gmail.com>2014-08-19 17:32:30 +0000
commit34ac9b5e25d3a00197ad30238d4e213f7811ebfe (patch)
tree5c632b3b63a03fa4148853693eaa68bbedc608b8 /clang/test/CoverageMapping/preprocessor.c
parentdd6394d83344a3f61ddcf9fa0804308146d6b888 (diff)
downloadbcm5719-llvm-34ac9b5e25d3a00197ad30238d4e213f7811ebfe.tar.gz
bcm5719-llvm-34ac9b5e25d3a00197ad30238d4e213f7811ebfe.zip
Add tests for coverage mapping generation.
This patch adds the tests for the coverage mapping generation. Most of the tests check the mapping regions produced by the generator, and one checks the llvm IR. Differential Revision: http://reviews.llvm.org/D4847 llvm-svn: 215995
Diffstat (limited to 'clang/test/CoverageMapping/preprocessor.c')
-rw-r--r--clang/test/CoverageMapping/preprocessor.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/clang/test/CoverageMapping/preprocessor.c b/clang/test/CoverageMapping/preprocessor.c
new file mode 100644
index 00000000000..a6edeb7c824
--- /dev/null
+++ b/clang/test/CoverageMapping/preprocessor.c
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name preprocessor.c %s | FileCheck %s
+
+ // CHECK: func
+void func() { // CHECK: File 0, [[@LINE]]:13 -> [[@LINE+5]]:2 = #0 (HasCodeBefore = 0)
+ int i = 0;
+#ifdef MACRO // CHECK-NEXT: Skipped,File 0, [[@LINE]]:2 -> [[@LINE+2]]:2 = 0 (HasCodeBefore = 0)
+ int x = i;
+#endif
+}
+
+#if 0
+ int g = 0;
+
+ void bar() { }
+#endif
+
+ // CHECK: main
+int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+19]]:2 = #0 (HasCodeBefore = 0)
+ int i = 0;
+#if 0 // CHECK-NEXT: Skipped,File 0, [[@LINE]]:2 -> [[@LINE+4]]:2 = 0 (HasCodeBefore = 0)
+ if(i == 0) {
+ i = 1;
+ }
+#endif
+
+#if 1
+ if(i == 0) { // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+2]]:4 = #1 (HasCodeBefore = 0)
+ i = 1;
+ }
+#else // CHECK-NEXT: Skipped,File 0, [[@LINE]]:2 -> [[@LINE+5]]:2 = 0 (HasCodeBefore = 0)
+ if(i == 1) {
+ i = 0;
+ }
+}
+#endif
+ return 0;
+}
OpenPOWER on IntegriCloud