[all-commits] [llvm/llvm-project] e33243: [clang-format] Link the braces of a block in Unwra...

Owen via All-commits all-commits at lists.llvm.org
Sun Dec 4 12:01:42 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e33243c950ac40d027ad8facbf7ccf0624604a16
      https://github.com/llvm/llvm-project/commit/e33243c950ac40d027ad8facbf7ccf0624604a16
  Author: Owen Pan <owenpiano at gmail.com>
  Date:   2022-12-04 (Sun, 04 Dec 2022)

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

  Log Message:
  -----------
  [clang-format] Link the braces of a block in UnwrappedLineParser

This includes TT_MacroBlockBegin and TT_MacroBlockEnd as well.

We can no longer use MatchingParen of FormatToken as an indicator
to mark optional braces. Instead, we directly set Optional of an
l_brace first and reset it later if it turns out that the braces
are not optional.

Also added a test case for deeply nested loops.

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




More information about the All-commits mailing list