[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

Erich Reitz via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 13:20:16 PDT 2024


Erich-Reitz wrote:

> This patch formats
> 
> ```
> void f() {
>   if (foo)
>     bar(); // Comment
> #if BAZ
>   baz();
> #endif
> }
> ```
> 
> to
> 
> ```
> void f() {
>   if (foo)
>     bar();
>         // Comment
> #if BAZ
>   baz();
> #endif
> }
> ```
> 
> The trailing comment shouldn't be wrapped.

thank you for catching that. I am going to close this as I don't know how to prevent `parseUnbracedBody` from consuming the ppd below it.

https://github.com/llvm/llvm-project/pull/94776


More information about the cfe-commits mailing list