<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/82259>82259</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            llvm-cov: wrong line coverage count for first line after condition in macro
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ManuelvOK
      </td>
    </tr>
</table>

<pre>
    In code with conditions in macros, the first line after the condition has the same count as the condition itself even if it is not executed.

`llvm-cov show` results in the following:
```
    1|       |# define RET    \
    2|      1|    if (0)      \
    3|      1|      return 1; \
    4|      1|    return 0;
    5|       |
    6|      1|int main() {
    7|      1| RET
    8|      1|}
```
With a purple line count `1` in line 2 and a red background on the `return 1;` in line 3.

Using braces on dedicated lines kind of circumvents the issue:
```
    1|       |# define RET \
    2|      1|    if (0)      \
    3|      1|    { \
    4|      0|      return 1; \
    5|      0|    } \
    6|      1|    return 0;
    7|       |
    8|      1|int main() {
    9|      1|    RET
   10|      1|}
```
Again, with a purple line count `1` in line 2, but now the red background spans from `{` to `}`.

Removing the macro while containing the backslashes leads to the correct line counts:
```
    1|      1|int main() {
    2|      1| if (0)      \
    3|      0|      return 1; \
    4|      1| return 0;
    5|      1|}
```

The line count calculation inside and outside macros should be consistent.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVV2P6jYQ_TXOy-gix_nkIQ934SJVVVVptVWfnXiSuNexke1A--8rO7CQpbeLqq5WgUzOjCdzDme4c3LQiA0pXkixT_jsR2ObX7ieUZ1-_Tlpjfir-UlDZwTCWfoROqOF9NJoB1LDxDtrHGE78CNCL63zoKRG4L1HG4PvCTByFyOOTyE8aw-XyA0jvUPVA55Qg-xBepAOtPGAf2I3exQbQveEfr1cS6rUafrSmRO40ZxJScGim5WP3cWejFLmLPVAslvS5T_eAgCkpNrB8keqHWEZCOzDa7x-e4vBYncDs3fwNU32QFhNCdteatzDswc4gEU_Ww0pyV7W4PwBfIFSkr3cYMW63_d4uUqX2sPEpSasDq2R6q5CtT7o9dvb7Vm9ekaq_T_O7fegBg7H2R4VLqQvnJKSpoEIqZcoA64FcLAooOXd98GaWQswCz-kpHfTuM_LVlT_5qQeoLW8QxdyBQrZcY8igh18l6FmD5203TydUPtFWtK5Gf8z9_8v8aT6Id30c20UD2BS7deQ8jn5VD-QT_20fLYPB90rKKVPKejrEKvvFmN5SkoB3c4etDlHdj9oyh25dtBbM4XU0HFJwZvlZk9KupLUK07mFFQVKkUng_MoVbQjz6W-PgoHOMXdiA4UcuFCycW2rMXO33XsnlPaZ-P9oLQnZfaEhj74yyfm8m_kLde3ccVXx1U3K744uXZSYPztm9nH78u2CE49KwFtHLSTzqP2m0Q0mdhmW55gk1a0zoptmufJ2NRlXWUFoxmmFEWXbWuWIs2LoheszplIZMMoyylLt2mZMsY2eU37VnRYZUVZ1y0lOcWJS7UJu2Jj7JBEU2hqxoptoniLysUNyJjG88UxGAsL0TZxv7Tz4EhOlXTe3ap46RU21wVEsq9wtkYP14Gc0PLhOpne2Mf1eLf2Lqs0ma1qRu-PUUjsQNhhkH6c201nJsIO4bDLx5ejNX9g5wk7xI4dYYf4Rn8HAAD__zt_I5c">