diff options
author | int-zjt <zhangjiatong.0@bytedance.com> | 2025-08-09 01:50:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-08 12:50:52 -0500 |
commit | f4cf610159189ec877142313a18698434386afb0 (patch) | |
tree | ca8ad7fdd6794940b87e187c7c3e4d14d39f6624 /mlir/lib/Bindings/Python/MainModule.cpp | |
parent | 0fffb9f9ed81f4c2084b8fe040c88b60bb6c372a (diff) | |
download | llvm-f4cf610159189ec877142313a18698434386afb0.zip llvm-f4cf610159189ec877142313a18698434386afb0.tar.gz llvm-f4cf610159189ec877142313a18698434386afb0.tar.bz2 |
[Coverage] Add gap region between binary operator '&& and ||' and RHS (#149085)
## Issue Summary
We identified an inaccuracy in line coverage reporting when short-circuit evaluation occurs in multi-line conditional expressions.
Specifically:
1. Un-executed conditions following line breaks may be incorrectly marked as covered
(e.g., conditionB in a non-executed && chain shows coverage)
```
1| |#include <iostream>
2| |
3| 1|int main() {
4| 1| bool conditionA = false;
5| 1| bool conditionB = true;
6| 1| if (conditionA &&
7| 1| conditionB) {
8| 0| std::cout << "IF-THEN" << std::endl;
9| 0| }
10| 1| return 0;
11| 1|}
```
2. Inconsistent coverage reporting across un-executed conditions
*(adjacent un-executed conditions may show 1 vs 0 line coverage)*
```
1| |#include <iostream>
2| |
3| 1|int main() {
4| 1| bool conditionA = false;
5| 1| bool conditionB = true;
6| 1| bool conditionC = true;
7| 1| if (conditionA &&
8| 1| (conditionB ||
9| 0| conditionC)) {
10| 0| std::cout << "IF-THEN" << std::endl;
11| 0| }
12| 1| return 0;
13| 1|}
```
This is resolved by inserting a GapRegion when mapping logical operators to isolate coverage contexts around short-circuit evaluation.
Diffstat (limited to 'mlir/lib/Bindings/Python/MainModule.cpp')
0 files changed, 0 insertions, 0 deletions