r317758 - [Coverage] Emit a gap area after if conditions
Vedant Kumar via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 8 18:33:39 PST 2017
Author: vedantk
Date: Wed Nov 8 18:33:38 2017
New Revision: 317758
URL: http://llvm.org/viewvc/llvm-project?rev=317758&view=rev
Log:
[Coverage] Emit a gap area after if conditions
The area immediately after the closing right-paren of an if condition
should have a count equal to the 'then' block's count. Use a gap region
to set this count, so that region highlighting for the 'then' block
remains precise.
This solves a problem we have with wrapped segments. Consider:
1| if (false)
2| foo();
Without a gap area starting after the condition, the wrapped segment
from line 1 would make it look like line 2 is executed, when it's not.
rdar://35373009
Modified:
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
cfe/trunk/test/CoverageMapping/break.c
cfe/trunk/test/CoverageMapping/casts.c
cfe/trunk/test/CoverageMapping/continue.c
cfe/trunk/test/CoverageMapping/if.cpp
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/switch.cpp
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=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Wed Nov 8 18:33:38 2017
@@ -718,6 +718,19 @@ struct CounterCoverageMappingBuilder
getRegion().setDeferred(true);
}
+ /// Emit a gap region between \p StartLoc and \p EndLoc with the given count.
+ void fillGapAreaWithCount(SourceLocation StartLoc, SourceLocation EndLoc,
+ Counter Count) {
+ if (StartLoc == EndLoc || StartLoc.isMacroID() || EndLoc.isMacroID() ||
+ !SM.isWrittenInSameFile(StartLoc, EndLoc))
+ return;
+ handleFileExit(StartLoc);
+ size_t Index = pushRegion(Count, StartLoc, EndLoc);
+ getRegion().setGap(true);
+ handleFileExit(EndLoc);
+ popRegions(Index);
+ }
+
/// \brief Keep counts of breaks and continues inside loops.
struct BreakContinue {
Counter BreakCount;
@@ -1048,12 +1061,19 @@ struct CounterCoverageMappingBuilder
// counter for the body when looking at the coverage.
propagateCounts(ParentCount, S->getCond());
+ // The 'then' count applies to the area immediately after the condition.
+ fillGapAreaWithCount(getPreciseTokenLocEnd(getEnd(S->getCond())),
+ getStart(S->getThen()), ThenCount);
+
extendRegion(S->getThen());
Counter OutCount = propagateCounts(ThenCount, S->getThen());
Counter ElseCount = subtractCounters(ParentCount, ThenCount);
if (const Stmt *Else = S->getElse()) {
- extendRegion(S->getElse());
+ // The 'else' count applies to the area immediately after the 'then'.
+ fillGapAreaWithCount(getPreciseTokenLocEnd(getEnd(S->getThen())),
+ getStart(Else), ElseCount);
+ extendRegion(Else);
OutCount = addCounters(OutCount, propagateCounts(ElseCount, Else));
} else
OutCount = addCounters(OutCount, ElseCount);
@@ -1090,9 +1110,14 @@ struct CounterCoverageMappingBuilder
Visit(E->getCond());
if (!isa<BinaryConditionalOperator>(E)) {
+ // The 'then' count applies to the area immediately after the condition.
+ fillGapAreaWithCount(E->getQuestionLoc(), getStart(E->getTrueExpr()),
+ TrueCount);
+
extendRegion(E->getTrueExpr());
propagateCounts(TrueCount, E->getTrueExpr());
}
+
extendRegion(E->getFalseExpr());
propagateCounts(subtractCounters(ParentCount, TrueCount),
E->getFalseExpr());
Modified: cfe/trunk/test/CoverageMapping/break.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/break.c?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/break.c (original)
+++ cfe/trunk/test/CoverageMapping/break.c Wed Nov 8 18:33:38 2017
@@ -15,7 +15,7 @@ int main() { // CHECK: File 0, [
} // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = ((#0 + #3) - #4)
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
+ if(cnt == 0) { // CHECK: File 0, [[@LINE]]:18 -> [[@LINE+3]]:6 = #4
break;
++cnt; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE+1]]:6 = 0
}
@@ -23,8 +23,8 @@ int main() { // CHECK: File 0, [
} // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = (#0 + #6)
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;
+ if(cnt == 0) { // CHECK: File 0, [[@LINE]]:18 -> [[@LINE+2]]:6 = #6
+ ++cnt; // CHECK-NEXT: Gap,File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = (#5 - #6)
} else { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = (#5 - #6)
break;
}
Modified: cfe/trunk/test/CoverageMapping/casts.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/casts.c?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/casts.c (original)
+++ cfe/trunk/test/CoverageMapping/casts.c Wed Nov 8 18:33:38 2017
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name casts.c %s | FileCheck %s
int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+4]]:2 = #0
- // CHECK-NEXT: File 0, [[@LINE+1]]:41 -> [[@LINE+1]]:54 = #1
+ // CHECK: File 0, [[@LINE+1]]:41 -> [[@LINE+1]]:54 = #1
int window_size = (sizeof(int) <= 2 ? (unsigned)512 : 1024); // CHECK-NEXT: File 0, [[@LINE]]:57 -> [[@LINE]]:61 = (#0 - #1)
return 0;
}
Modified: cfe/trunk/test/CoverageMapping/continue.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/continue.c?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/continue.c (original)
+++ cfe/trunk/test/CoverageMapping/continue.c Wed Nov 8 18:33:38 2017
@@ -8,16 +8,16 @@ int main() { // CHECK
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)
+ } else { // CHECK: 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: 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)
+ } else j = 5; // CHECK: File 0, [[@LINE]]:14 -> [[@LINE]]:19 = ((#2 - #3) - #4)
j = 6; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE+1]]:6 = ((#2 - #3) - #4)
- } else // CHECK-NEXT: File 0, [[@LINE+1]]:7 -> [[@LINE+1]]:12 = (#1 - #2)
+ } else // CHECK: File 0, [[@LINE+1]]:7 -> [[@LINE+1]]:12 = (#1 - #2)
j = 7;
j = 8; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+1]]:4 = ((#1 - #3) - #4)
}
Modified: cfe/trunk/test/CoverageMapping/if.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/if.cpp?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/if.cpp (original)
+++ cfe/trunk/test/CoverageMapping/if.cpp Wed Nov 8 18:33:38 2017
@@ -3,35 +3,41 @@
int nop() { return 0; }
// CHECK-LABEL: _Z3foov:
-void foo() { // CHECK-NEXT: [[@LINE]]:12 -> [[@LINE+5]]:2 = #0
+ // CHECK-NEXT: [[@LINE+1]]:12 -> [[@LINE+6]]:2 = #0
+void foo() { // CHECK-NEXT: Gap,File 0, [[@LINE+1]]:20 -> [[@LINE+1]]:22 = #2
if (int j = true ? nop() // CHECK-NEXT: [[@LINE]]:22 -> [[@LINE]]:27 = #2
: nop(); // CHECK-NEXT: [[@LINE]]:22 -> [[@LINE]]:27 = (#0 - #2)
j) // CHECK-NEXT: [[@LINE]]:7 -> [[@LINE]]:8 = #0
- ++j; // CHECK-NEXT: [[@LINE]]:5 -> [[@LINE]]:8 = #1
-}
+ ++j; // CHECK-NEXT: [[@LINE-1]]:9 -> [[@LINE]]:5 = #1
+} // CHECK-NEXT: [[@LINE-1]]:5 -> [[@LINE-1]]:8 = #1
// CHECK-LABEL: main:
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
+ // CHECK-NEXT: File 0, [[@LINE+2]]:6 -> [[@LINE+2]]:12 = #0
+ // CHECK-NEXT: Gap,File 0, [[@LINE+1]]:13 -> [[@LINE+1]]:14 = #1
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)
+ if(i == 1) // CHECK-NEXT: Gap,File 0, [[@LINE]]:13 -> [[@LINE+1]]:5 = #2
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;
+ if(i == 0) { i = 1; // CHECK-NEXT: Gap,File 0, [[@LINE]]:13 -> [[@LINE]]:14 = #3
+ i = 2; // CHECK-NEXT: File 0, [[@LINE-1]]:14 -> [[@LINE+1]]:4 = #3
}
// 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)
- i = 3;
+ if(i != 0) { // CHECK-NEXT: Gap,File 0, [[@LINE]]:13 -> [[@LINE]]:14 = #4
+ i = 1; // CHECK-NEXT: File 0, [[@LINE-1]]:14 -> [[@LINE+1]]:4 = #4
+ } else { // CHECK-NEXT: Gap,File 0, [[@LINE]]:4 -> [[@LINE]]:10 = (#0 - #4)
+ i = 3; // CHECK-NEXT: File 0, [[@LINE-1]]:10 -> [[@LINE+1]]:4 = (#0 - #4)
}
- i = i == 0?
+ i = i == 0? // CHECK-NEXT: Gap,File 0, [[@LINE]]:13 -> [[@LINE+1]]:9 = #5
i + 1 : // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:14 = #5
i + 2; // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:14 = (#0 - #5)
+
+ // CHECK-NEXT: Gap,File 0, [[@LINE+2]]:13 -> [[@LINE+2]]:14 = #6
// CHECK-NEXT: File 0, [[@LINE+1]]:14 -> [[@LINE+1]]:20 = #6
i = i == 0?i + 12:i + 10; // CHECK-NEXT: File 0, [[@LINE]]:21 -> [[@LINE]]:27 = (#0 - #6)
Modified: cfe/trunk/test/CoverageMapping/includehell.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/includehell.cpp?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/includehell.cpp (original)
+++ cfe/trunk/test/CoverageMapping/includehell.cpp Wed Nov 8 18:33:38 2017
@@ -52,28 +52,28 @@ int main() {
// 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: File [[CODE1]], 4:13 -> 6:2 = #2
+// CHECK-CODE: 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 [[CODE1]], 9:11 -> 11:2 = #3
+// CHECK-CODE: 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: File [[CODE2]], 4:13 -> 6:2 = #6
+// CHECK-CODE: 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-CODE: File [[CODE2]], 9:11 -> 11:2 = #7
+// CHECK-CODE: 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 [[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 [[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
+// CHECK-END: 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=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/label.cpp (original)
+++ cfe/trunk/test/CoverageMapping/label.cpp Wed Nov 8 18:33:38 2017
@@ -6,27 +6,27 @@ void func() { // CHECK-NE
// CHECK-NEXT: File 0, [[@LINE+1]]:22 -> [[@LINE+1]]:25 = #3
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
+ if(i < 5) { // CHECK: File 0, [[@LINE]]:15 -> [[@LINE+6]]:6 = #2
{
x: // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE+4]]:6 = #3
int j = 1;
}
int m = 2;
} else
- goto x; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = (#1 - #2)
+ goto x; // CHECK: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = (#1 - #2)
int k = 3; // CHECK-NEXT: File 0, [[@LINE-1]]:13 -> [[@LINE]]:5 = #3
} // CHECK-NEXT: File 0, [[@LINE-1]]:5 -> [[@LINE]]:4 = #3
static int j = 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:2 = ((#0 + #3) - #1)
++j;
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
+ goto x; // CHECK: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #4
// CHECK-NEXT: File 0, [[@LINE-1]]:11 -> [[@LINE+1]]:2 = (((#0 + #3) - #1) - #4)
}
// CHECK-NEXT: test1
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 a; // CHECK: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #1
// CHECK-NEXT: File 0, [[@LINE-1]]:11 -> [[@LINE+1]]:3 = (#0 - #1)
goto b; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:2 = (#0 - #1)
// CHECK-NEXT: File 0, [[@LINE-1]]:3 -> [[@LINE+4]]:2 = #3
@@ -38,11 +38,11 @@ b: // CHECK-NE
// CHECK-NEXT: test2
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]]:11 -> [[@LINE+3]]:8 = #0
+ goto a; // CHECK: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #1
+ // CHECK: Gap,File 0, [[@LINE-1]]:12 -> [[@LINE+3]]:8 = (#0 - #1)
// CHECK-NEXT: File 0, [[@LINE+2]]:8 -> [[@LINE+3]]:11 = (#0 - #1)
// CHECK-NEXT: File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:17 = (#0 - #1)
- else if(x == 1) // CHECK-NEXT: File 0, [[@LINE+1]]:5 -> [[@LINE+1]]:11 = #2
+ else if(x == 1) // CHECK: File 0, [[@LINE+1]]:5 -> [[@LINE+1]]:11 = #2
goto b; // CHECK-NEXT: File 0, [[@LINE]]:11 -> [[@LINE+1]]:1 = #3
a: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+3]]:2 = #3
b: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+2]]:2 = #4
@@ -55,7 +55,7 @@ int main() { // CHECK-NE
for(int i = 0; i < 10; ++i) { // CHECK: File 0, [[@LINE]]:31 -> [[@LINE+13]]:4 = #1
a: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+12]]:4 = #2
if(i < 3) // CHECK-NEXT: File 0, [[@LINE]]:8 -> [[@LINE]]:13 = #2
- goto e; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = #3
+ goto e; // CHECK: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = #3
// CHECK-NEXT: File 0, [[@LINE-1]]:13 -> [[@LINE+1]]:5 = (#2 - #3)
goto c; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+8]]:4 = (#2 - #3)
Modified: cfe/trunk/test/CoverageMapping/macro-expansion.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/macro-expansion.c?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/macro-expansion.c (original)
+++ cfe/trunk/test/CoverageMapping/macro-expansion.c Wed Nov 8 18:33:38 2017
@@ -4,18 +4,18 @@
// 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: 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+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: 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: 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)
// CHECK-NEXT: File 4, [[@LINE+4]]:15 -> [[@LINE+4]]:38 = #0
@@ -40,7 +40,7 @@
// 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: File 9, {{[0-9]+}}:27 -> {{[0-9]+}}:29 = #10
// CHECK-NEXT: File 9, {{[0-9]+}}:39 -> {{[0-9]+}}:40 = ((#0 + #8) + #9)
void func(int x) {
Modified: cfe/trunk/test/CoverageMapping/macro-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/macro-expressions.cpp?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/macro-expressions.cpp (original)
+++ cfe/trunk/test/CoverageMapping/macro-expressions.cpp Wed Nov 8 18:33:38 2017
@@ -54,7 +54,7 @@ void STMT(fn3)() {
// 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
+ // CHECK: File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:12 = #1
if (0) {}
// CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:7 -> [[@LINE+2]]:11 = #0
@@ -86,10 +86,10 @@ void foo(int i) {
// CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:23 -> [[@LINE+1]]:29 = #0
(void)(i ? PRIo64 : PRIu64);
- // CHECK-NEXT: File 0, [[@LINE+5]]:14 -> [[@LINE+5]]:15 = #9
+ // CHECK: File 0, [[@LINE+5]]:14 -> [[@LINE+5]]:15 = #9
// CHECK-NEXT: Expansion,File 0, [[@LINE+4]]:18 -> [[@LINE+4]]:22 = (#0 - #9)
// CHECK-NEXT: File 0, [[@LINE+3]]:22 -> [[@LINE+3]]:33 = (#0 - #9)
- // CHECK-NEXT: File 0, [[@LINE+2]]:28 -> [[@LINE+2]]:29 = #10
+ // CHECK: File 0, [[@LINE+2]]:28 -> [[@LINE+2]]:29 = #10
// CHECK-NEXT: File 0, [[@LINE+1]]:32 -> [[@LINE+1]]:33 = ((#0 - #9) - #10)
(void)(i ? i : EXPR(i) ? i : 0);
// CHECK-NEXT: Expansion,File 0, [[@LINE+3]]:15 -> [[@LINE+3]]:19 = (#0 - #11)
Modified: cfe/trunk/test/CoverageMapping/macroscopes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/macroscopes.cpp?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/macroscopes.cpp (original)
+++ cfe/trunk/test/CoverageMapping/macroscopes.cpp Wed Nov 8 18:33:38 2017
@@ -89,10 +89,10 @@ int main() {
// 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: 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: 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
// CHECK-NEXT: File 4, 3:24 -> 3:53 = #0
@@ -101,10 +101,10 @@ int main() {
// 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: 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: 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
// CHECK-NEXT: File 7, 3:24 -> 3:53 = #0
Modified: cfe/trunk/test/CoverageMapping/moremacros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/moremacros.c?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/moremacros.c (original)
+++ cfe/trunk/test/CoverageMapping/moremacros.c Wed Nov 8 18:33:38 2017
@@ -7,7 +7,7 @@
// 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
+ if (!argc) {} // CHECK: 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
@@ -27,7 +27,7 @@ int main(int argc, const char *argv[]) {
// 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
+ // CHECK: File 0, [[@LINE+1]]:14 -> [[@LINE+4]]:8 = #4
if (!argc) {
return 0;
// CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:8 = #4
Modified: cfe/trunk/test/CoverageMapping/objc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/objc.m?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/objc.m (original)
+++ cfe/trunk/test/CoverageMapping/objc.m Wed Nov 8 18:33:38 2017
@@ -7,7 +7,7 @@
// CHECK: func
void func(A *a) { // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+3]]:2 = #0
if (a) // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:8 = #0
- [a bork: 20 ]; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:20 = #1
+ [a bork: 20 ]; // CHECK: File 0, [[@LINE]]:5 -> [[@LINE]]:20 = #1
}
@interface NSArray
@@ -20,9 +20,9 @@ void func2(NSArray *array) { // CHECK-
int i = 0;
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
+ if (x) { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = #2
i = 1;
- } else { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = (#1 - #2)
+ } else { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = (#1 - #2)
i = -1;
}
}
Modified: cfe/trunk/test/CoverageMapping/preprocessor.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/preprocessor.c?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/preprocessor.c (original)
+++ cfe/trunk/test/CoverageMapping/preprocessor.c Wed Nov 8 18:33:38 2017
@@ -19,7 +19,7 @@ int main() { // CHECK-NEXT: File 0,
#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
+ if(i == 0) { // CHECK: File 0, [[@LINE]]:14 -> [[@LINE+2]]:4 = #1
i = 1;
}
#else // CHECK-NEXT: Skipped,File 0, [[@LINE]]:1 -> [[@LINE+6]]:1 = 0
Modified: cfe/trunk/test/CoverageMapping/return.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/return.c?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/return.c (original)
+++ cfe/trunk/test/CoverageMapping/return.c Wed Nov 8 18:33:38 2017
@@ -12,13 +12,13 @@ void func2() { // CHECK
// 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 -> {{[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
+ if(i > 2) { // CHECK: File 0, [[@LINE]]:15 -> [[@LINE+2]]:6 = #2
return; // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+3]]:5 = (#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
+ if(i == 3) { // CHECK: File 0, [[@LINE]]:16 -> [[@LINE+2]]:6 = #3
int j = 1;
- } else { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = ((#1 - #2) - #3)
+ } else { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = ((#1 - #2) - #3)
int j = 2;
}
}
@@ -27,7 +27,7 @@ void func2() { // CHECK
// CHECK-NEXT: func3
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
+ if(x > 5) { // CHECK: 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
--x; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE+1]]:6 = 0
Modified: cfe/trunk/test/CoverageMapping/switch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/switch.cpp?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/switch.cpp (original)
+++ cfe/trunk/test/CoverageMapping/switch.cpp Wed Nov 8 18:33:38 2017
@@ -38,7 +38,7 @@ void bar(int i) { // CHECK-NEXT: File
// CHECK: baz
void baz() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+5]]:2 = #0
- switch (int i = true ? nop() // CHECK-NEXT: [[@LINE]]:26 -> [[@LINE]]:31 = #2
+ switch (int i = true ? nop() // CHECK: [[@LINE]]:26 -> [[@LINE]]:31 = #2
: nop(); // CHECK-NEXT: [[@LINE]]:26 -> [[@LINE]]:31 = (#0 - #2)
i) {}
nop(); // CHECK-NEXT: [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
Modified: cfe/trunk/test/CoverageMapping/switchmacro.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/switchmacro.c?rev=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/switchmacro.c (original)
+++ cfe/trunk/test/CoverageMapping/switchmacro.c Wed Nov 8 18:33:38 2017
@@ -7,7 +7,7 @@ int foo(int i) { // CHECK-NEXT: File 0,
switch (i) {
default: // CHECK-NEXT: File 0, [[@LINE]]:3 -> {{[0-9]+}}:11 = #2
if (i == 1) // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:15 = #2
- return 0; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:15 = #3
+ return 0; // CHECK: File 0, [[@LINE]]:7 -> [[@LINE]]:15 = #3
// CHECK-NEXT: File 0, [[@LINE-1]]:15 -> [[@LINE+3]]:5 = (#2 - #3)
// CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:5 -> [[@LINE+2]]:8 = (#2 - #3) (Expanded file = 1)
// 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=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/test.c (original)
+++ cfe/trunk/test/CoverageMapping/test.c Wed Nov 8 18:33:38 2017
@@ -16,7 +16,7 @@ int main() { // CHEC
// CHECK-NEXT: foo
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
+ if(1) { // CHECK: 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=317758&r1=317757&r2=317758&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/trycatch.cpp (original)
+++ cfe/trunk/test/CoverageMapping/trycatch.cpp Wed Nov 8 18:33:38 2017
@@ -12,12 +12,12 @@ class Warning {
// CHECK: func
void func(int i) { // CHECK-NEXT: File 0, [[@LINE]]:18 -> {{[0-9]+}}:2 = #0
// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:11 = #0
- if(i % 2) { // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE+4]]:4 = #1
+ if(i % 2) { // CHECK: File 0, [[@LINE]]:13 -> [[@LINE+4]]:4 = #1
throw Error();
int j = 0; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:4 = 0
- // CHECK-NEXT: File 0, [[@LINE+1]]:10 -> [[@LINE+2]]:27 = (#0 - #1)
+ // CHECK: File 0, [[@LINE+1]]:10 -> [[@LINE+2]]:27 = (#0 - #1)
} else if(i == 8) // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE]]:19 = (#0 - #1)
- throw ImportantError(); // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:27 = #2
+ throw ImportantError(); // CHECK: File 0, [[@LINE]]:5 -> [[@LINE]]:27 = #2
} // CHECK-NEXT: File 0, [[@LINE-1]]:27 -> [[@LINE]]:2 = ((#0 - #1) - #2)
// CHECK-NEXT: main
More information about the cfe-commits
mailing list