[PATCH] D139257: [clang-format] Link the braces of a block in UnwrappedLineParser

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 8 18:54:55 PST 2022


owenpan added a comment.

I have second thoughts about linking block braces in `UnwrappedLineParser`. Consider the following example:

  #if A
  while (a) { // Linked to the r_brace below
  #else
  while(b) { // Also linked to the r_brace below
  #endif
    foo();
  }  // Linked to the l_brace of while(b) above

The `l_brace` of `while (a)` is still linked  to the `r_brace` that has been re-linked to another `l_bace`.

Because `MatchingParen` will be reset in the annotator anyway, linking it for block braces in `UnwrappedLineParser` has little or no value. I will revert this patch if no one objects.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139257/new/

https://reviews.llvm.org/D139257



More information about the cfe-commits mailing list