[all-commits] [llvm/llvm-project] 1443db: [clang-format] Handle "complex" conditionals in Re...

Owen via All-commits all-commits at lists.llvm.org
Sat May 21 14:46:57 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1443dbaba6f0e57be066995db9164f89fb57b413
      https://github.com/llvm/llvm-project/commit/1443dbaba6f0e57be066995db9164f89fb57b413
  Author: owenca <owenpiano at gmail.com>
  Date:   2022-05-21 (Sat, 21 May 2022)

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

  Log Message:
  -----------
  [clang-format] Handle "complex" conditionals in RemoveBracesLLVM

Do not remove braces if the conditional of if/for/while might not
fit on a single line even after the opening brace is removed.

Examples:
// ColumnLimit: 20
// 45678901234567890
if (a) { /* Remove. */
  foo();
}
if (-b >= c) { // Keep.
  bar();
}

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




More information about the All-commits mailing list