[all-commits] [llvm/llvm-project] f14ebe: [clang-format] Skip preprocessor lines when findin...

aeubanks via All-commits all-commits at lists.llvm.org
Thu Apr 14 09:31:41 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f14ebe91c5dd6be5b64a45e479291cd08676be0c
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2022-04-14 (Thu, 14 Apr 2022)

  Changed paths:
    M clang/lib/Format/UnwrappedLineFormatter.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  [clang-format] Skip preprocessor lines when finding the record lbrace

With D117142, we would now format

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


struct A {
#ifdef A
  void f() {

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

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

Reviewed By: curdeius, owenpan

Differential Revision: https://reviews.llvm.org/D123737

More information about the All-commits mailing list