<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54419>54419</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Source-based code coverage incorrectly handles if constexpr block
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
coverage
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chfast
</td>
</tr>
</table>
<pre>
When a `if constexpr` has a block `{}` and the condition is false, the source-based code coverage always marks the opening `{` as not-executed region (see line 4).
Tested with clang 14.
```
1| |template <int C>
2| 1|int test() {
3| 1| if constexpr (C == 0)
------------------
| Branch (3:19): [Folded - Ignored]
------------------
4| 0| {
5| 1| return 1;
6| 1| }
7| 1| return 0;
8| 1|}
9| |
10| |int main()
11| 1|{
12| 1| return test<1>();
13| 1|}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFU0tv5CAM_jXkgmYUQh7NIYd2ZivteVfaMwFPwpaBEZC28-_XZF5Np9UiFDD-_NmO7d6pY_dnBEsFJXWud1Q6GyK8HzyKdBQBFb1x8iWpSfNEmm1SCKtoHCGhlY7aWaoD3QkTgBSbWRPc5CWsehFAIUwl7Ct4MQAV5k0cA90L_xJmrDuA1Xa4uEj8gVoXV_AOcopI4GFITkjxEACo0RZoSYp2TfItyR9P398QEvRNx5FKI5CPlQtAoj_tWaS4GGk29LTwFmF_MCICJXyjbaQbwn_csMUVm6ySPqJHDAkDoSnuK5IvkOn8-GNTFht0scVNczS-GK7u1kUzszx5YeWYrDnhj6xNlvyRkurp2RmFma_oz8E6D4pU2_9zUvyDlzDz822RRXWXRVoe4uQtPvEP0PoOmvrkqm7u1GeWfMHysIAtGNpFna7vLF-8p5rshbanmtxQ7BPxzScrvgttri3fsNQCJ7oPoTL-daif-ixTHVctb0UWdTTQ_fp-JrSVznuQ0Rxx6qwyEJZNMw9hNnnTjTEeAlaeFM-4B2z3qV9Lt0fBmNfLsTp49xf5UNQhTBDwUpUla7OxU1VdSdk3QsJDJXdS4K3kddszyYoaeGZEDyZ02FqkKOZZwjNNdhLPIaeXapvprsiLIuesYVVesmJdqbbeqTrvYSfrRvSkzAGLYtYpqrXzQ-a7OcB-GgIqjQ4x3JQiBD1YgNk58ospjs53ctyJELM5lW7O4x-P7UTu">