owenpan added a comment.

In D127260#3567476 <https://reviews.llvm.org/D127260#3567476>, @curdeius wrote:

> Still looks good. Was there a particular case where the previous version 
> didn't work?

The assertion I added on line 2626, which would ensure that the `RemoveBraces` 
lambda on line 898 didn't miss any potentially removable braces, would fail 
because `parseLevel()` was indiscriminately passing the `l_brace` of the last 
`if` in the level to its caller. This new version is also a tiny bit more 
efficient because `IfLBrace` on line 2624 will be null if the `else` block that 
encloses the `if` block is not a simple block.

Because neither version would remove non-optional braces, I decided not to add 
a test case just for the assertion, e.g.,

  if (a)
    b;
  else {
    c;
    if (d) {
      e;
      f;
    }
  }


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

https://reviews.llvm.org/D127260

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to