llvm-cov shows a dead closing bracket in a switch as uncovered code
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The example file:
```cpp
enum class E {A, B};
void test(E e)
{
switch (e)
{
case E::A:
{
break;
}
default:
{
break;
}
}
}
int main()
{
test(E::A);
test(E::B);
return 0;
}
```
The brackets after the `break;` statements are reported as uncovered code:
```
1| |enum class E {A, B};
2| |
3| |void test(E e)
4| 2|{
5| 2| switch (e)
6| 2| {
7| 1| case E::A:
8| 1| {
9| 1| break;
10| 0| }
11| 1| default:
12| 1| {
13| 1| break;
14| 0| }
15| 2| }
16| 2|}
17| |
18| |int main()
19| 1|{
20| 1| test(E::A);
21| 1| test(E::B);
22| 1| return 0;
23| 1|}
```
Contributor guide
Research direction
Reproduce the inline C++ example with llvm-cov and inspect the generated coverage report, since no repository file or test is named. Trace how the switch-case closing braces are represented in the coverage output, then add or update coverage expectations so executed closing braces are not reported as uncovered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100