<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64956>64956</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM Source-Based coverage reports missing coverage on closing braces on switch statements
</td>
</tr>
<tr>
<th>Labels</th>
<td>
coverage
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
carlosgalvezp
</td>
</tr>
</table>
<pre>
Consider the following code:
```cpp
#include <iostream>
enum E
{
a,
b,
c
};
void foo(E e)
{
switch (e)
{
case a:
{
std::cout << "a\n";
break;
} // <<<<<<<<<<< Missing coverage
case b:
{
std::cout << "b\n";
break;
} // <<<<<<<<<<< Missing coverage
case c:
{
std::cout << "c\n";
break;
} // <<<<<<<<<<< Missing coverage
}
}
int main()
{
foo(a);
foo(b);
foo(c);
}
```
Running source-based coverage as per the docs leads to 88% coverage instead of 100% coverage, because the braces after the "break" are considered as "executable" but "not-executed".
Is this intended? If not, is it possible to configure LLVM to ignore braces when computing coverage statistics?
Thanks!
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVE2P2zYQ_TXUZbCGNLL8cdAh642BAMmlLXrnx0hiQ5ECh9pt--sLyl_aJOglh9YQbOvNcOY98nEks-09USuaZ9G8FHJOQ4itltEF7qV7pb-nQgXzV3sKnq2hCGkg6IJz4c36HnQwJOoPonwR5e17V14ePU1XBGvrtZsNgahPNnCKJEdRf1wvIz-PcEP2z5c_AABS4Onxpt696Vv-i6if19VegzXQhSDw8BFI4PHbwvxmkx5A4OERzRXftV5aSCaQd403-Lu8_OFkcmL9QYc5Za2iPoFAlKI5eYF4J7lepCLJr99FxP4FQOBZ4Pla6F8e-GKZL8fxSlH29AMJ6uckqP-BBP1zEvR_JyEb9O7UlU2tTzBK6wUefuBRgKuFZQ7euV0w9Q67p-o1_Oh2u5Pr5r_M3me6HOao6UlJJnPnDpJhul53EzSDI2kYUoDDQWDzyLOeE0kDoYOqLNchgSdQpOXMtJRRUWpikF261s22WrYdEWQk0NcZQyZ3F4j0J-k5SeUop6h8mog-pKdLgIxA3KwlfWJIg2WwPpE3ZER9hk8d-JAymRxIMAVmqxxlLTr4zvZzJPj8-fcvGbG9D_HO9W0gDzqM05zWBwucZLKcrGZRn9cEfhuk_8oCq8K0tTnWR1lQW-2OeNg3ZV0VQ9tQtTONqY5dhd226qSq98ZUpum6rtZHKmyLJdblAbdVVdZNtTnukGSp97JR292-kmJb0iit2zj3Om5C7AvLPFO72x6bXeGkIsfLQEd8HAXm8R7bvORJzT2LbeksJ34USTY5apd9-PXiiOf3jog0hZgYxm9sDsGDdmHBrvsW_G3A5p2ikXziYo6uHVKaON_O5U71Ng2z2ugwCjxnItefpymGP0gngedFGgs8L-r-CQAA__-n4df-">