[all-commits] [llvm/llvm-project] cdbe29: [clang-format] Fix lambda formatting in conditional

Björn Schäpers via All-commits all-commits at lists.llvm.org
Thu Nov 3 05:09:25 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cdbe296853b1b3fc6415236f05770360e23f0d39
      https://github.com/llvm/llvm-project/commit/cdbe296853b1b3fc6415236f05770360e23f0d39
  Author: Björn Schäpers <bjoern at hazardy.de>
  Date:   2022-11-03 (Thu, 03 Nov 2022)

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

  Log Message:
  -----------
  [clang-format] Fix lambda formatting in conditional

Without the patch UnwrappedLineFormatter::analyzeSolutionSpace just ran
out of possible formattings and would put everything just on one line.
The problem was that the the line break was forbidden, but putting the
conditional colon on the same line is also forbidden.

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


  Commit: f97639ce13754e78e26f8d7f564830ddfe4f727c
      https://github.com/llvm/llvm-project/commit/f97639ce13754e78e26f8d7f564830ddfe4f727c
  Author: Björn Schäpers <bjoern at hazardy.de>
  Date:   2022-11-03 (Thu, 03 Nov 2022)

  Changed paths:
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/unittests/Format/TokenAnnotatorTest.cpp

  Log Message:
  -----------
  [clang-format] Don't misannotate in CTor init list

They were annotated with TrailingAnnotation, which they are not. And
that resulted in some quirky formatting in some cases.

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


Compare: https://github.com/llvm/llvm-project/compare/e53c4c6d8617...f97639ce1375


More information about the All-commits mailing list