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

    <tr>
        <th>Summary</th>
        <td>
            clang-format-18 Comments alligned across scopes
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

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

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

<pre>
    The following snippet

```
void foo() {
#if 1   // reference
#elif 0 // slower
#else   // slowest
#endif  // 0
} // foo
```

formattted with clang-format-17 using the following configuration

```
Language: Cpp
```

is formatted in the following way using clang-format-18

```
void foo() {
#if 1   // reference
#elif 0 // slower
#else   // slowest
#endif  // 0
} // foo
```

as you can see the comment at the end foo is alligned with other comments inside another scope
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzck8uOozwQhZ_GbEqJjLmFBYu-KKt_-b9AgQvwjLGRy3SUtx9BSNLdGvUDjISMXMc2X52DkdkMjqgRxaso3hNc4uhD8xvthK5IWq-vzf8jQe-t9RfjBmBn5pmikO9CvuxjKfdnm354o6H3XqiTUDWI6nVfpjLTQwoAQp2FOkOgngK5jh46WdODvOts_YXCJ5HpuXkTOT5Vp03_UHcUUb3fKyvQ32hvY-_DhDFG0nAxcYTOohsOt-ohrWDhtff4xYnOu94MS8BovPvBj__QDQsOJLIXeJvnHygMww5CGoz79r0LXneOr3SnfywLZLj6BTp0wESbCZ2fJnIRMG5TcltTYBjQ2vUH3mPzcaRwX81gHBtNgO5W587PlOgm03VWY0JNWtZlmheqrJKxKYtWqgq7AklX7Ql1KU9lXfWyzqnWbZ6YRkmVpVKmslJVXh0JJbVdXuQnnVOfpiKXNKGxR2s_pqMPQ2KYF2rKqpZlYrEly9tFU-pzgkKp9eqFZt12aJeBRS6t4cjPg6KJlppvucPbvdGHC9gFz3zrlJMl2GaMcWaRvdysH0wcl_bY-Umo83r6_jrMwf-iLgp13phZqPOG_ScAAP__NCM5hw">