File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -907,6 +907,9 @@ struct CoverageMapping : public ASTWalker {
907
907
908
908
// / Subtract \c Expr from \c Node's counter.
909
909
void subtractFromCounter (ASTNode Node, CounterExpr Expr) {
910
+ if (Expr.isZero ())
911
+ return ;
912
+
910
913
auto Counter = getCounter (Node);
911
914
assert (!Counter.isZero () && " Cannot create a negative counter" );
912
915
assignCounter (Node,
Original file line number Diff line number Diff line change @@ -130,3 +130,12 @@ func hoo() { // CHECK-NEXT: [[@LINE]]:12 -> [[@LINE+5]]:2 : 0
130
130
i += 1 // CHECK-NEXT: [[@LINE-1]]:18 -> [[@LINE+1]]:4 : 1
131
131
} // CHECK-NEXT: [[@LINE]]:4 -> [[@LINE+1]]:2 : 0
132
132
}
133
+
134
+ // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_while.ioo
135
+ func ioo( ) { // CHECK-NEXT: [[@LINE]]:12 -> [[@LINE+6]]:2 : 0
136
+ repeat { // CHECK-NEXT: [[@LINE]]:10 -> [[@LINE+3]]:4 : 1
137
+ break // CHECK-NEXT: [[@LINE+1]]:5 -> [[@LINE+1]]:10 : zero
138
+ break // FIXME: This next region seems wrong, we exit the loop the same number of times we enter (rdar://118472537).
139
+ } while true // CHECK-NEXT: [[@LINE]]:4 -> [[@LINE+2]]:2 : (0 - 1)
140
+ // CHECK-NEXT: [[@LINE-1]]:11 -> [[@LINE-1]]:15 : zero
141
+ } // CHECK-NEXT: }
You can’t perform that action at this time.
0 commit comments