summaryrefslogtreecommitdiffstats
path: root/clang/test/CoverageMapping/md.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-02-18 21:24:51 +0000
committerJustin Bogner <mail@justinbogner.com>2015-02-18 21:24:51 +0000
commitbf42cfd75fcaf6a98e8781cb49c07c181f6b4330 (patch)
tree4d68cf5ec62c0fc00c58817adfaf157a3b83d7d0 /clang/test/CoverageMapping/md.cpp
parentcd8fb60fce21b985b87c0e9b7aaefc43e94f316b (diff)
downloadbcm5719-llvm-bf42cfd75fcaf6a98e8781cb49c07c181f6b4330.tar.gz
bcm5719-llvm-bf42cfd75fcaf6a98e8781cb49c07c181f6b4330.zip
InstrProf: Rewrite most of coverage mapping generation in a simpler way
The coverage mapping generation code previously generated a large number of redundant coverage regions and then tried to merge similar ones back together. This then relied on some awkward heuristics to prevent combining of regions that were importantly different but happened to have the same count. The end result was inefficient and hard to follow. Now, we more carefully create the regions we actually want. This makes it much easier to create regions at precise locations as well as making the basic approach quite a bit easier to follow. There's still a fair bit of complexity here dealing with included code and macro expansions, but that's pretty hard to avoid without significantly reducing the quality of data we provide. I had to modify quite a few tests where the source ranges became more precise or the old ranges seemed to be wrong anyways, and I've added quite a few new tests since a large number of constructs didn't seem to be tested before. llvm-svn: 229748
Diffstat (limited to 'clang/test/CoverageMapping/md.cpp')
-rw-r--r--clang/test/CoverageMapping/md.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/CoverageMapping/md.cpp b/clang/test/CoverageMapping/md.cpp
new file mode 100644
index 00000000000..fff0df35265
--- /dev/null
+++ b/clang/test/CoverageMapping/md.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++11 %s | FileCheck %s
+
+#define BREAK break
+
+enum class MD {
+ Val1,
+ Val2
+};
+
+void nop() {}
+
+// CHECK: foo
+// CHECK-NEXT: File 0, [[@LINE+1]]:16 -> {{[0-9]+}}:2 = #0
+void foo(MD i) {
+ switch (i) {
+ #define HANDLE_MD(X) \
+ case MD::X: \
+ break;
+ #include "Inputs/md.def"
+ default:
+ BREAK;
+ }
+
+ if (false)
+ nop();
+ #define HANDLE_MD(X) else if (i == MD::X) { nop(); }
+ #include "Inputs/md.def"
+}
+
+int main(int argc, const char *argv[]) {
+ foo(MD::Val1);
+ return 0;
+}
OpenPOWER on IntegriCloud