[PATCH] D109951: [clang-format] Constructor initializer lists format with pp directives

Josh Learn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 17 15:14:30 PDT 2021


guitard0g added a comment.

When looking at test case suggestions, I happened upon another problem that occurs when handling preprocessor directives. The following code is properly formatted (following llvm style, with ColumnLimit=0):

  SomeClass::SomeClass()
    : a{a},
      b{b} {}

However this code:

  Foo::Foo()
      : x{x},
  #if DEBUG
        y{y},
  #endif
        z{z} {}

Is transformed by clang-format (under the same style guidelines) into this:

  Foo::Foo()
      : x{x},
  #if DEBUG
        y{y},
  #endif
        z{z} {
  }

It seems there is some wonkiness with how it handles preprocessor statements here. I can address this in a another patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109951



More information about the cfe-commits mailing list