<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/164414>164414</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[llvm-cov] catch after uncovered catch is considered uncovered
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TorstenIhben
</td>
</tr>
</table>
<pre>
Hi!
In our tests we have code with chained catch statements where only one of them is actually executed. If this is the first catch, everything is fine, but if the catch block that's followed by an uncovered catch block is executed, the first line (the catch itself) is considered as uncovered. I see this pattern in multiple locations, so this seems to be a general issue with llvm-cov. When using gcov everything is marked correctly as covered and uncovered.
My example code looks like this:
`
try {
throw SomeException(__FILE__, __LINE__, "...");
} catch (const SpecialExcepption&) { // uncovered
x = 0;
} catch (const SomeException&) { // executed
x = 1;
}
`
We verify by checking the value of x that indeed the second catch is executed. But still, llvm-cov marks the catch as uncovered:
`
110 : try {
111 2 : throw SomeException(__FILE__, __LINE__, "...");
112 0 : } catch (const SpecialExcepption&) {
113 0 : x = 0;
114 0 : } catch (const SomeException&) {
115 2 : x = 1;
116 : }
`
Is this a known issue, or are we using llvm-cov or interpreting the results in a wrong way?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVUuv4yYU_jVkczQWYOe18CK3d6JGmnYzlWYZYXwS02CI4Di5-fcVtvMczVWr3s21wvHH9wKrGM3eIZZs-sam7xPVUeND-ZcPkdBtmgrdpPL1pfzdMCkYX20c-C4AYaQIZ4RGnRC0rxHOhhrQjTIOa9CKdAORFGGLLo02GBC8sxfwDsHvgBpswURQmjpl7QXwA3VHWGewSasmplVqEHYmRBogmfwN8IThQo1x-zSwMw7Tr1VHYHrUcfPKen0AahQxOY-w89b6M9ZQXUA56Jz2Jww3qsO0iTcWCfO-uTUOgcnFHd5QRLtjcple0t5FU_dwKt6xM9hARBzEHBURBgfGQdtZMkeLYL1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