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

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 9 11:47:03 PST 2022


HazardyKnusperkeks added a comment.

In D139257#3983332 <https://reviews.llvm.org/D139257#3983332>, @owenpan wrote:

> 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.

I don't like it, but that seems to be the reasonable approach.


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