File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -661,7 +661,7 @@ struct CoverageMapping : public ASTWalker {
661
661
assignCounter (E);
662
662
} else if (auto *IE = dyn_cast<IfExpr>(E)) {
663
663
CounterExpr &ThenCounter = assignCounter (IE->getThenExpr ());
664
- if (Parent. isNull ())
664
+ if (RegionStack. empty ())
665
665
assignCounter (IE->getElseExpr ());
666
666
else
667
667
assignCounter (IE->getElseExpr (),
Original file line number Diff line number Diff line change @@ -14,3 +14,40 @@ var i : Int32 = 0
14
14
while ( i < 10 ) {
15
15
i += 1
16
16
}
17
+
18
+ // CHECK: sil_coverage_map{{.*}}__tlcd_line:[[@LINE+3]]:1
19
+ // CHECK-NEXT: [[@LINE+2]]:17 -> [[@LINE+2]]:18 : 1
20
+ // CHECK-NEXT: [[@LINE+1]]:21 -> [[@LINE+1]]:22 : 0
21
+ var i2 = true ? 1 : 0 ;
22
+
23
+ // CHECK: sil_coverage_map{{.*}}__tlcd_line:[[@LINE+4]]:1
24
+ // CHECK-NEXT: [[@LINE+3]]:11 -> [[@LINE+5]]:2 : 1
25
+ // CHECK-NEXT: [[@LINE+2]]:1 -> [[@LINE+4]]:2 : 0
26
+ // CHECK-NEXT: [[@LINE+3]]:2 -> [[@LINE+3]]:2 : 0
27
+ if ( true ) {
28
+ i2 = 2
29
+ }
30
+
31
+ // Crash tests:
32
+
33
+ if ( true ) {
34
+ i2 = 3
35
+ } else {
36
+ i2 = 4
37
+ }
38
+
39
+ while ( i2 > 0 ) {
40
+ if ( true ) {
41
+ i2 -= 1
42
+ continue
43
+ } else {
44
+ i2 -= 1
45
+ break
46
+ }
47
+ }
48
+
49
+ switch ( 1 ) {
50
+ case 0 : fallthrough
51
+ case 1 : break
52
+ default : break
53
+ }
You can’t perform that action at this time.
0 commit comments