Commits
Vedant Kumar committed 376870e357c
[Coverage] Fix handling of return statements within repeat-while loops
In 2a34b7c6, we introduced an incorrect test case for return statements
within repeat-while loops. Consider this situation:
repeat { // Region 1
return
} while C1 // Should be "zero", not "Region 1"
The fix requires maintaining a stack of active repeat-while loops. This
is an accepted idiom (c.f the clang CoverageMapping implementation). To
see why a stack is needed, consider:
repeat { // Region 1
repeat { // Region 2
if (C1) { // Region 3
return
}
} while C2 // Should be "Region 2 - *Region 3*", not "Region 2"
} while C3 // Should be "Region 1 - *Region 3*", not "Region 1"
rdar://problem/24572268