r229813 - InstrProf: Always emit a coverage region for the condition of an if

Justin Bogner mail at justinbogner.com
Wed Feb 18 19:10:31 PST 2015


Author: bogner
Date: Wed Feb 18 21:10:30 2015
New Revision: 229813

URL: http://llvm.org/viewvc/llvm-project?rev=229813&view=rev
Log:
InstrProf: Always emit a coverage region for the condition of an if

When tools like llvm-cov show regions, it's much easier to understand
what's happening if the condition of an if shows a counter as well as
the body.

Modified:
    cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
    cfe/trunk/test/CoverageMapping/break.c
    cfe/trunk/test/CoverageMapping/continue.c
    cfe/trunk/test/CoverageMapping/if.c
    cfe/trunk/test/CoverageMapping/includehell.cpp
    cfe/trunk/test/CoverageMapping/label.cpp
    cfe/trunk/test/CoverageMapping/macro-expansion.c
    cfe/trunk/test/CoverageMapping/macro-expressions.cpp
    cfe/trunk/test/CoverageMapping/macroscopes.cpp
    cfe/trunk/test/CoverageMapping/moremacros.c
    cfe/trunk/test/CoverageMapping/objc.m
    cfe/trunk/test/CoverageMapping/preprocessor.c
    cfe/trunk/test/CoverageMapping/return.c
    cfe/trunk/test/CoverageMapping/switchmacro.c
    cfe/trunk/test/CoverageMapping/test.c
    cfe/trunk/test/CoverageMapping/trycatch.cpp

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Wed Feb 18 21:10:30 2015
@@ -787,11 +787,14 @@ struct CounterCoverageMappingBuilder
 
   void VisitIfStmt(const IfStmt *S) {
     extendRegion(S);
-    Visit(S->getCond());
 
     Counter ParentCount = getRegion().getCounter();
     Counter ThenCount = getRegionCounter(S);
 
+    // Emitting a counter for the condition makes it easier to interpret the
+    // counter for the body when looking at the coverage.
+    propagateCounts(ParentCount, S->getCond());
+
     extendRegion(S->getThen());
     Counter OutCount = propagateCounts(ThenCount, S->getThen());
 

Modified: cfe/trunk/test/CoverageMapping/break.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/break.c?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/break.c (original)
+++ cfe/trunk/test/CoverageMapping/break.c Wed Feb 18 21:10:30 2015
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name break.c %s | FileCheck %s
 
-int main() {         // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+28]]:2 = #0
+int main() {         // CHECK: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0
   int cnt = 0;       // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = #0
   while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+3]]:4 = #1
     break;
@@ -13,14 +13,16 @@ int main() {         // CHECK: File 0, [
     }
     ++cnt;
   }                  // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = ((#0 + #3) - #4)
-  while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+6]]:4 = #3
+  while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+7]]:4 = #3
+                     // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:16 = #3
     if(cnt == 0) {   // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+3]]:6 = #4
       break;
       ++cnt;         // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE+1]]:6 = 0
     }
     ++cnt;           // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+1]]:4 = (#3 - #4)
   }                  // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = (#0 + #6)
-  while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+7]]:4 = #5
+  while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+8]]:4 = #5
+                     // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:16 = #5
     if(cnt == 0) {   // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+2]]:6 = #6
       ++cnt;
     } else {         // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = (#5 - #6)

Modified: cfe/trunk/test/CoverageMapping/continue.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/continue.c?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/continue.c (original)
+++ cfe/trunk/test/CoverageMapping/continue.c Wed Feb 18 21:10:30 2015
@@ -4,15 +4,15 @@ int main() {                    // CHECK
   int j = 0;                    // CHECK-NEXT: File 0, [[@LINE+2]]:18 -> [[@LINE+2]]:24 = (#0 + #1)
                                 // CHECK-NEXT: File 0, [[@LINE+1]]:26 -> [[@LINE+1]]:29 = #1
   for(int i = 0; i < 20; ++i) { // CHECK-NEXT: File 0, [[@LINE]]:31 -> [[@LINE+17]]:4 = #1
-    if(i < 10) {                // CHECK-NEXT: File 0, [[@LINE]]:16 -> [[@LINE+13]]:6 = #2
-      if(i < 5) {               // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+3]]:8 = #3
+    if(i < 10) {                // CHECK: File 0, [[@LINE]]:16 -> [[@LINE+13]]:6 = #2
+      if(i < 5) {               // CHECK: File 0, [[@LINE]]:17 -> [[@LINE+3]]:8 = #3
         continue;
         j = 1;                   // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE+1]]:8 = 0
       } else {                   // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+2]]:8 = (#2 - #3)
         j = 2;
       }
       j = 3;                     // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE+6]]:6 = (#2 - #3)
-      if(i < 7) {                // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+3]]:8 = #4
+      if(i < 7) {                // CHECK: File 0, [[@LINE]]:17 -> [[@LINE+3]]:8 = #4
         continue;
         j = 4;                   // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE+1]]:8 = 0
       } else j = 5;              // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE]]:19 = ((#2 - #3) - #4)

Modified: cfe/trunk/test/CoverageMapping/if.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/if.c?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/if.c (original)
+++ cfe/trunk/test/CoverageMapping/if.c Wed Feb 18 21:10:30 2015
@@ -1,13 +1,17 @@
 // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name if.c %s | FileCheck %s
 
-int main() {                    // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+21]]:2 = #0
+int main() {                    // CHECK: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0
   int i = 0;
+                                // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
   if(i == 0) i = 1;             // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE]]:19 = #1
+                                // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
   if(i == 1)
     i = 2;                      // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:10 = #2
+                                // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
   if(i == 0) { i = 1;           // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+2]]:4 = #3
     i = 2;
   }
+                                // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
   if(i != 0) {                  // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+2]]:4 = #4
     i = 1;
   } else {                      // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE+2]]:4 = (#0 - #4)

Modified: cfe/trunk/test/CoverageMapping/includehell.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/includehell.cpp?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/includehell.cpp (original)
+++ cfe/trunk/test/CoverageMapping/includehell.cpp Wed Feb 18 21:10:30 2015
@@ -51,22 +51,29 @@ int main() {
 // CHECK-START-NEXT: File [[START3]], 4:29 -> 5:1 = #9
 
 // CHECK-CODE:      File [[CODE1:[0-9]]], 1:1 -> 14:1 = #1
+// CHECK-CODE-NEXT: File [[CODE1]], 4:5 -> 4:11 = #1
 // CHECK-CODE-NEXT: File [[CODE1]], 4:13 -> 6:2 = #2
 // CHECK-CODE-NEXT: File [[CODE1]], 6:8 -> 8:2 = (#1 - #2)
+// CHECK-CODE-NEXT: File [[CODE1]], 9:5 -> 9:9 = #1
 // CHECK-CODE-NEXT: File [[CODE1]], 9:11 -> 11:2 = #3
 // CHECK-CODE-NEXT: File [[CODE1]], 11:8 -> 13:2 = (#1 - #3)
 // CHECK-CODE:      File [[CODE2:[0-9]]], 1:1 -> 14:1 = #5
+// CHECK-CODE-NEXT: File [[CODE2]], 4:5 -> 4:11 = #5
 // CHECK-CODE-NEXT: File [[CODE2]], 4:13 -> 6:2 = #6
 // CHECK-CODE-NEXT: File [[CODE2]], 6:8 -> 8:2 = (#5 - #6)
+// CHECK-CODE-NEXT: File [[CODE2]], 9:5 -> 9:9 = #5
 // CHECK-CODE-NEXT: File [[CODE2]], 9:11 -> 11:2 = #7
 // CHECK-CODE-NEXT: File [[CODE2]], 11:8 -> 13:2 = (#5 - #7)
 
 // CHECK-END:      File [[END1:[0-9]]], 1:1 -> 3:2 = #1
 // CHECK-END-NEXT: File [[END1]], 1:1 -> 6:1 = #0
+// CHECK-END-NEXT: File [[END1]], 5:5 -> 5:9 = #0
 // CHECK-END-NEXT: File [[END1]], 5:11 -> 5:16 = #4
 // CHECK-END:      File [[END2:[0-9]]], 1:1 -> 3:2 = #5
 // CHECK-END-NEXT: File [[END2]], 1:1 -> 6:1 = #0
+// CHECK-END-NEXT: File [[END2]], 5:5 -> 5:9 = #0
 // CHECK-END-NEXT: File [[END2]], 5:11 -> 5:16 = #8
 // CHECK-END:      File [[END3:[0-9]]], 1:1 -> 3:2 = #9
 // CHECK-END-NEXT: File [[END3]], 1:1 -> 6:1 = #0
+// CHECK-END-NEXT: File [[END3]], 5:5 -> 5:9 = #0
 // CHECK-END-NEXT: File [[END3]], 5:11 -> 5:16 = #10

Modified: cfe/trunk/test/CoverageMapping/label.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/label.cpp?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/label.cpp (original)
+++ cfe/trunk/test/CoverageMapping/label.cpp Wed Feb 18 21:10:30 2015
@@ -1,10 +1,11 @@
 // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name label.cpp %s | FileCheck %s
 
                              // CHECK: func
-void func() {                // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE+18]]:2 = #0
+void func() {                // CHECK-NEXT: File 0, [[@LINE]]:13 -> {{[0-9]+}}:2 = #0
   int i = 0;                 // CHECK-NEXT: File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:20 = (#0 + #3)
                              // CHECK-NEXT: File 0, [[@LINE+1]]:22 -> [[@LINE+1]]:25 = #3
-  for(i = 0; i < 10; ++i) {  // CHECK-NEXT: File 0, [[@LINE]]:27 -> [[@LINE+10]]:4 = #1
+  for(i = 0; i < 10; ++i) {  // CHECK-NEXT: File 0, [[@LINE]]:27 -> [[@LINE+11]]:4 = #1
+                             // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:13 = #1
     if(i < 5) {              // CHECK-NEXT: File 0, [[@LINE]]:15 -> [[@LINE+6]]:6 = #2
       {
         x:                   // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE+4]]:6 = #3
@@ -17,13 +18,13 @@ void func() {                // CHECK-NE
   }
   static int j = 0;          // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:2 = ((#0 + #3) - #1)
   ++j;
-  if(j == 1)
+  if(j == 1)                 // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:12 = ((#0 + #3) - #1)
     goto x;                  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #4
 }
 
                              // CHECK-NEXT: test1
-void test1(int x) {          // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE+7]]:2 = #0
-  if(x == 0)
+void test1(int x) {          // CHECK-NEXT: File 0, [[@LINE]]:19 -> {{[0-9]+}}:2 = #0
+  if(x == 0)                 // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:12 = #0
     goto a;                  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #1
   goto b;                    // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:9 = (#0 - #1)
 a:                           // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+3]]:2 = #2
@@ -32,10 +33,11 @@ b:                           // CHECK-NE
 }
 
                              // CHECK-NEXT: test2
-void test2(int x) {          // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE+8]]:2 = #0
-  if(x == 0)
+void test2(int x) {          // CHECK-NEXT: File 0, [[@LINE]]:19 -> {{[0-9]+}}:2 = #0
+  if(x == 0)                 // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:12 = #0
     goto a;                  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #1
-                             // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:25 = (#0 - #1)
+                             // CHECK-NEXT: File 0, [[@LINE+2]]:8 -> [[@LINE+2]]:25 = (#0 - #1)
+                             // CHECK-NEXT: File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:17 = (#0 - #1)
   else if(x == 1) goto b;    // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE]]:25 = #2
 a:                           // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+3]]:2 = #3
 b:                           // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+2]]:2 = #4
@@ -43,11 +45,11 @@ b:                           // CHECK-NE
 }
 
                              // CHECK-NEXT: main
-int main() {                 // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+17]]:2 = #0
+int main() {                 // CHECK-NEXT: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0
   int j = 0;
   for(int i = 0; i < 10; ++i) { // CHECK: File 0, [[@LINE]]:31 -> [[@LINE+11]]:4 = #1
   a:                         // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+10]]:4 = #2
-    if(i < 3)
+    if(i < 3)                // CHECK-NEXT: File 0, [[@LINE]]:8 -> [[@LINE]]:13 = #2
       goto e;                // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = #3
     goto c;                  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = (#2 - #3)
   b:                         // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:4 = #4

Modified: cfe/trunk/test/CoverageMapping/macro-expansion.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/macro-expansion.c?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/macro-expansion.c (original)
+++ cfe/trunk/test/CoverageMapping/macro-expansion.c Wed Feb 18 21:10:30 2015
@@ -1,17 +1,20 @@
 // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name macro-expansion.c %s | FileCheck %s
 
 // CHECK: func
-// CHECK:      File 1, [[@LINE+4]]:12 -> [[@LINE+4]]:38 = #0
-// CHECK-NEXT: File 1, [[@LINE+3]]:15 -> [[@LINE+3]]:28 = (#0 + #2)
+// CHECK:      File 1, [[@LINE+5]]:12 -> [[@LINE+5]]:38 = #0
+// CHECK-NEXT: File 1, [[@LINE+4]]:15 -> [[@LINE+4]]:28 = (#0 + #2)
+// CHECK-NEXT: File 1, [[@LINE+3]]:21 -> [[@LINE+3]]:22 = (#0 + #2)
 // CHECK-NEXT: File 1, [[@LINE+2]]:24 -> [[@LINE+2]]:26 = #3
 // CHECK-NEXT: File 1, [[@LINE+1]]:36 -> [[@LINE+1]]:37 = (#0 + #2)
 #define M1 do { if (0) {} } while (0)
-// CHECK-NEXT: File 2, [[@LINE+8]]:15 -> [[@LINE+8]]:41 = #0
-// CHECK-NEXT: File 2, [[@LINE+7]]:18 -> [[@LINE+7]]:31 = (#0 + #4)
-// CHECK-NEXT: File 2, [[@LINE+6]]:27 -> [[@LINE+6]]:29 = #5
-// CHECK-NEXT: File 2, [[@LINE+5]]:39 -> [[@LINE+5]]:40 = (#0 + #4)
-// CHECK-NEXT: File 3, [[@LINE+4]]:15 -> [[@LINE+4]]:41 = #0
-// CHECK-NEXT: File 3, [[@LINE+3]]:18 -> [[@LINE+3]]:31 = (#0 + #6)
+// CHECK-NEXT: File 2, [[@LINE+10]]:15 -> [[@LINE+10]]:41 = #0
+// CHECK-NEXT: File 2, [[@LINE+9]]:18 -> [[@LINE+9]]:31 = (#0 + #4)
+// CHECK-NEXT: File 2, [[@LINE+8]]:24 -> [[@LINE+8]]:25 = (#0 + #4)
+// CHECK-NEXT: File 2, [[@LINE+7]]:27 -> [[@LINE+7]]:29 = #5
+// CHECK-NEXT: File 2, [[@LINE+6]]:39 -> [[@LINE+6]]:40 = (#0 + #4)
+// CHECK-NEXT: File 3, [[@LINE+5]]:15 -> [[@LINE+5]]:41 = #0
+// CHECK-NEXT: File 3, [[@LINE+4]]:18 -> [[@LINE+4]]:31 = (#0 + #6)
+// CHECK-NEXT: File 3, [[@LINE+3]]:24 -> [[@LINE+3]]:25 = (#0 + #6)
 // CHECK-NEXT: File 3, [[@LINE+2]]:27 -> [[@LINE+2]]:29 = #7
 // CHECK-NEXT: File 3, [[@LINE+1]]:39 -> [[@LINE+1]]:40 = (#0 + #6)
 #define M2(x) do { if (x) {} } while (0)
@@ -34,6 +37,7 @@
 // Check for the expansion of M2 within M3.
 // CHECK-NEXT: File 9, {{[0-9]+}}:15 -> {{[0-9]+}}:41 = (#0 + #8)
 // CHECK-NEXT: File 9, {{[0-9]+}}:18 -> {{[0-9]+}}:31 = ((#0 + #8) + #9)
+// CHECK-NEXT: File 9, {{[0-9]+}}:24 -> {{[0-9]+}}:25 = ((#0 + #8) + #9)
 // CHECK-NEXT: File 9, {{[0-9]+}}:27 -> {{[0-9]+}}:29 = #10
 // CHECK-NEXT: File 9, {{[0-9]+}}:39 -> {{[0-9]+}}:40 = ((#0 + #8) + #9)
 

Modified: cfe/trunk/test/CoverageMapping/macro-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/macro-expressions.cpp?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/macro-expressions.cpp (original)
+++ cfe/trunk/test/CoverageMapping/macro-expressions.cpp Wed Feb 18 21:10:30 2015
@@ -15,6 +15,7 @@
 // CHECK: foo
 // CHECK-NEXT: File 0, [[@LINE+1]]:17 -> {{[0-9]+}}:2 = #0
 void foo(int i) {
+  // CHECK-NEXT: File 0, [[@LINE+2]]:7 -> [[@LINE+2]]:8 = #0
   // CHECK-NEXT: File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:12 = #1
   if (0) {}
 

Modified: cfe/trunk/test/CoverageMapping/macroscopes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/macroscopes.cpp?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/macroscopes.cpp (original)
+++ cfe/trunk/test/CoverageMapping/macroscopes.cpp Wed Feb 18 21:10:30 2015
@@ -72,8 +72,10 @@ int main() {
 // CHECK-NEXT: File 1, 3:47 -> 3:50 = #1
 // CHECK-NEXT: File 1, 3:52 -> 3:53 = #1
 // CHECK-NEXT: File 2, 10:3 -> 20:4 = #1
+// CHECK-NEXT: File 2, 11:7 -> 11:13 = #1
 // CHECK-NEXT: File 2, 11:15 -> 13:4 = #2
 // CHECK-NEXT: File 2, 13:10 -> 15:4 = (#1 - #2)
+// CHECK-NEXT: File 2, 16:7 -> 16:11 = #1
 // CHECK-NEXT: File 2, 16:13 -> 18:4 = #3
 // CHECK-NEXT: File 2, 18:10 -> 20:4 = (#1 - #3)
 // CHECK-NEXT: File 3, 6:3 -> 7:4 = #1
@@ -82,8 +84,10 @@ int main() {
 // CHECK-NEXT: File 4, 3:47 -> 3:50 = #4
 // CHECK-NEXT: File 4, 3:52 -> 3:53 = #4
 // CHECK-NEXT: File 5, 10:3 -> 20:4 = #4
+// CHECK-NEXT: File 5, 11:7 -> 11:13 = #4
 // CHECK-NEXT: File 5, 11:15 -> 13:4 = #5
 // CHECK-NEXT: File 5, 13:10 -> 15:4 = (#4 - #5)
+// CHECK-NEXT: File 5, 16:7 -> 16:11 = #4
 // CHECK-NEXT: File 5, 16:13 -> 18:4 = #6
 // CHECK-NEXT: File 5, 18:10 -> 20:4 = (#4 - #6)
 // CHECK-NEXT: File 6, 6:3 -> 7:4 = #4

Modified: cfe/trunk/test/CoverageMapping/moremacros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/moremacros.c?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/moremacros.c (original)
+++ cfe/trunk/test/CoverageMapping/moremacros.c Wed Feb 18 21:10:30 2015
@@ -4,10 +4,12 @@
 #define RBRAC }
 
 // CHECK: main:
-// CHECK-NEXT: File 0, [[@LINE+1]]:40 -> [[@LINE+24]]:2 = #0
+// CHECK-NEXT: File 0, [[@LINE+1]]:40 -> {{[0-9]+}}:2 = #0
 int main(int argc, const char *argv[]) {
+  // CHECK-NEXT: File 0, [[@LINE+1]]:7 -> [[@LINE+1]]:12 = #0
   if (!argc) {} // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE]]:16 = #1
 
+  // CHECK-NEXT: File 0, [[@LINE+3]]:7 -> [[@LINE+3]]:12 = #0
   // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:19 = #2
   // CHECK-NEXT: File 0, [[@LINE+1]]:19 -> [[@LINE+4]]:8 = #2
   if (!argc) LBRAC
@@ -15,14 +17,16 @@ int main(int argc, const char *argv[]) {
   // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:8 = #2
   RBRAC
 
-  // CHECK-NEXT: File 0, [[@LINE+3]]:3 -> [[@LINE+13]]:2 = (#0 - #2)
+  // CHECK-NEXT: File 0, [[@LINE+4]]:3 -> [[@LINE+15]]:2 = (#0 - #2)
+  // CHECK-NEXT: File 0, [[@LINE+3]]:7 -> [[@LINE+3]]:12 = (#0 - #2)
   // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:19 = #3
   // CHECK-NEXT: File 0, [[@LINE+1]]:19 -> [[@LINE+3]]:4 = #3
   if (!argc) LBRAC
     return 0;
   }
 
-  // CHECK-NEXT: File 0, [[@LINE+2]]:3 -> [[@LINE+6]]:2 = ((#0 - #2) - #3)
+  // CHECK-NEXT: File 0, [[@LINE+3]]:3 -> [[@LINE+7]]:2 = ((#0 - #2) - #3)
+  // CHECK-NEXT: File 0, [[@LINE+2]]:7 -> [[@LINE+2]]:12 = ((#0 - #2) - #3)
   // CHECK-NEXT: File 0, [[@LINE+1]]:14 -> [[@LINE+4]]:8 = #4
   if (!argc) {
     return 0;

Modified: cfe/trunk/test/CoverageMapping/objc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/objc.m?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/objc.m (original)
+++ cfe/trunk/test/CoverageMapping/objc.m Wed Feb 18 21:10:30 2015
@@ -6,7 +6,7 @@
 
                       // CHECK: func
 void func(A *a) {     // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+3]]:2 = #0
-  if (a)
+  if (a)              // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:8 = #0
     [a bork:  20  ];  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:20 = #1
 }
 
@@ -16,9 +16,10 @@ void func(A *a) {     // CHECK-NEXT: Fil
 @end
 
                                // CHECK: func2
-void func2(NSArray *array) {   // CHECK-NEXT: File 0, [[@LINE]]:28 -> [[@LINE+10]]:2 = #0
+void func2(NSArray *array) {   // CHECK-NEXT: File 0, [[@LINE]]:28 -> {{[0-9]+}}:2 = #0
   int i = 0;
-  for (NSArray *x in array) {  // CHECK-NEXT: File 0, [[@LINE]]:29 -> [[@LINE+6]]:4 = #1
+  for (NSArray *x in array) {  // CHECK-NEXT: File 0, [[@LINE]]:29 -> [[@LINE+7]]:4 = #1
+                               // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:10 = #1
     if (x) {                   // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = #2
       i = 1;
     } else {                   // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = (#1 - #2)

Modified: cfe/trunk/test/CoverageMapping/preprocessor.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/preprocessor.c?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/preprocessor.c (original)
+++ cfe/trunk/test/CoverageMapping/preprocessor.c Wed Feb 18 21:10:30 2015
@@ -15,7 +15,7 @@ void func() {    // CHECK: File 0, [[@LI
 #endif
 
                  // CHECK: main
-int main() {     // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+19]]:2 = #0
+int main() {     // CHECK-NEXT: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0
   int i = 0;
 #if 0            // CHECK-NEXT: Skipped,File 0, [[@LINE]]:2 -> [[@LINE+4]]:2 = 0
   if(i == 0) {
@@ -24,6 +24,7 @@ int main() {     // CHECK-NEXT: File 0,
 #endif
 
 #if 1
+                 // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
   if(i == 0) {   // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+2]]:4 = #1
     i = 1;
   }

Modified: cfe/trunk/test/CoverageMapping/return.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/return.c?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/return.c (original)
+++ cfe/trunk/test/CoverageMapping/return.c Wed Feb 18 21:10:30 2015
@@ -7,13 +7,15 @@ void func() {                   // CHECK
 }
 
                                 // CHECK-NEXT: func2
-void func2() {                  // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+13]]:2 = #0
+void func2() {                  // CHECK-NEXT: File 0, [[@LINE]]:14 -> {{[0-9]+}}:2 = #0
                                 // CHECK-NEXT: File 0, [[@LINE+2]]:18 -> [[@LINE+2]]:24 = ((#0 + #1) - #2)
                                 // CHECK-NEXT: File 0, [[@LINE+1]]:26 -> [[@LINE+1]]:29 = (#1 - #2)
-  for(int i = 0; i < 10; ++i) { // CHECK-NEXT: File 0, [[@LINE]]:31 -> [[@LINE+9]]:4 = #1
+  for(int i = 0; i < 10; ++i) { // CHECK-NEXT: File 0, [[@LINE]]:31 -> {{[0-9]+}}:4 = #1
+                                // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:13 = #1
     if(i > 2) {                 // CHECK-NEXT: File 0, [[@LINE]]:15 -> [[@LINE+2]]:6 = #2
       return;
-    }                           // CHECK-NEXT: File 0, [[@LINE+1]]:5 -> [[@LINE+6]]:4 = (#1 - #2)
+    }                           // CHECK-NEXT: File 0, [[@LINE+2]]:5 -> {{[0-9]+}}:4 = (#1 - #2)
+                                // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:14 = (#1 - #2)
     if(i == 3) {                // CHECK-NEXT: File 0, [[@LINE]]:16 -> [[@LINE+2]]:6 = #3
       int j = 1;
     } else {                    // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = ((#1 - #2) - #3)
@@ -23,7 +25,8 @@ void func2() {                  // CHECK
 }
 
                                // CHECK-NEXT: func3
-void func3(int x) {            // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE+9]]:2 = #0
+void func3(int x) {            // CHECK-NEXT: File 0, [[@LINE]]:19 -> {{[0-9]+}}:2 = #0
+                               // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:11 = #0
   if(x > 5) {                  // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE+6]]:4 = #1
     while(x >= 9) {            // CHECK-NEXT: File 0, [[@LINE]]:11 -> [[@LINE]]:17 = #1
       return;                  // CHECK-NEXT: File 0, [[@LINE-1]]:19 -> [[@LINE+2]]:6 = #2

Modified: cfe/trunk/test/CoverageMapping/switchmacro.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/switchmacro.c?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/switchmacro.c (original)
+++ cfe/trunk/test/CoverageMapping/switchmacro.c Wed Feb 18 21:10:30 2015
@@ -6,7 +6,7 @@
 int foo(int i) { // CHECK-NEXT: File 0, [[@LINE]]:16 -> {{[0-9]+}}:2 = #0
   switch (i) {
   default:       // CHECK-NEXT: File 0, [[@LINE]]:3 -> {{[0-9]+}}:11 = #2
-    if (i == 1)
+    if (i == 1)  // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:15 = #2
       return 0;  // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:15 = #3
     // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:5 -> [[@LINE+2]]:8 = (#2 - #3)
     // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> {{[0-9]+}}:11 = (#2 - #3)

Modified: cfe/trunk/test/CoverageMapping/test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/test.c?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/test.c (original)
+++ cfe/trunk/test/CoverageMapping/test.c Wed Feb 18 21:10:30 2015
@@ -14,7 +14,8 @@ int main() {                     // CHEC
 }
 
                                  // CHECK-NEXT: foo
-void foo() {                     // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+4]]:2 = #0
+void foo() {                     // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+5]]:2 = #0
+                                 // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:7 = #0
   if(1) {                        // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE+2]]:4 = #1
     int i = 0;
   }

Modified: cfe/trunk/test/CoverageMapping/trycatch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/trycatch.cpp?rev=229813&r1=229812&r2=229813&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/trycatch.cpp (original)
+++ cfe/trunk/test/CoverageMapping/trycatch.cpp Wed Feb 18 21:10:30 2015
@@ -10,10 +10,11 @@ class Warning {
 };
 
                                       // CHECK: func
-void func(int i) {                    // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+5]]:2 = #0
-  if(i % 2)
+void func(int i) {                    // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+6]]:2 = #0
+  if(i % 2)                           // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:11 = #0
     throw Error();                    // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:18 = #1
-  else if(i == 8)                     // CHECK-NEXT: File 0, [[@LINE]]:8 -> [[@LINE+1]]:27 = (#0 - #1)
+                                      // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+2]]:27 = (#0 - #1)
+  else if(i == 8)                     // CHECK-NEXT: File 0, [[@LINE]]:11 -> [[@LINE]]:17 = (#0 - #1)
     throw ImportantError();           // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:27 = #2
 }
 





More information about the cfe-commits mailing list