Typz added a comment.

There are actually other cases, e.g. with macros "containing" the semicolon:

  void abort() {
    FOO()
    BAR()
  };

gets reformatted to this (still wrong with this patch, but the space after the 
parenthesis is added):

  void abort(){ FOO() BAR() };

And also this one (though it may be slightly different, there is no semicolon 
here):

  void abort() {
    FOO()
  }
  uint32_t bar() {}

gets reformatted to:

  void abort(){ FOO() BAR() } uint32_t bar() {}

IMO the "real" fix would be to somehow let 
`TokenAnnotator::calculateFormattingInformation` split the current 
UnwrappedLine/AnnotatedLine, so that the 'end of the line' could be unwrapped 
properly: this would also allow keeping the invariant, and just implement some 
kind of backtracking. But it may be tricky to get the state right; maybe adding 
some child lines instead of just adding the lines may be simpler?


Repository:
  rC Clang

https://reviews.llvm.org/D42729



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

Reply via email to