This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Skip preprocessor lines when finding the record lbrace
ClosedPublic

Authored by aeubanks on Apr 13 2022, 2:40 PM.

Details

Summary

With D117142, we would now format

struct A {
#define A
  void f() { a(); }
#endif
};

into

struct A {
#ifdef A
  void f() {
    a();
  }
#endif
};

because we were looking for the record lbrace without skipping preprocess lines.

Fixes https://github.com/llvm/llvm-project/issues/54901.

Diff Detail