[PATCH] D137052: [clang-format] Don't skip #else/#elif of #if 0

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 19:38:48 PDT 2022


owenpan added a comment.

In D137052#3895426 <https://reviews.llvm.org/D137052#3895426>, @sstwcw wrote:

> This patch fixes the regression caused by 2183fe2 <https://reviews.llvm.org/rG2183fe2160fbcb754893e98829f2bff4d0fccfa3> while introducing a new regression.  But in my opinion the new regression is less of a problem than the old one.  Therefore I think it is okay.
>
> Take this piece of code similar to the example in 71814b4.
>
> before
>
>   void SomeFunction(int param1,
>                     template <
>   #ifdef A
>   #if 0
>   #endif
>                         MyType<Some>>
>   #else
>                         Type1, Type2>
>   #endif
>                     param2,
>                     param3) {
>     f();
>   }
>
> after
>
>   void SomeFunction(int param1,
>                     template <
>   #ifdef A
>   #if 0
>   #endif
>                         MyType<Some>>
>   #else
>                     Type1,
>                     Type2 >
>   #endif
>                         param2,
>                     param3) {
>     f();
>   }

Fixed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137052/new/

https://reviews.llvm.org/D137052



More information about the cfe-commits mailing list