jolesiak added inline comments.

================
Comment at: lib/Format/UnwrappedLineParser.cpp:2137
+  do {
+    if (FormatTok->Tok.isOneOf(tok::semi, tok::r_brace)) {
+      nextToken();
----------------
`tok::r_brace` could be skiped - see comment to line 2143.


================
Comment at: lib/Format/UnwrappedLineParser.cpp:2143
+      parseBlock(/*MustBeDeclaration=*/false);
+      addUnwrappedLine();
+    } else {
----------------
We have to add `return` after `addUnwrappedLine` as `parseBlock` does consume 
`tok::r_brace`. Without `return` we will consume tokens after `}`. This problem 
will rarely occur as most lines end with `tok::semi` or `tok::r_brace` and it 
will be terminated properly (however maybe not handled properly as we just skip 
every token in `else`) by `if` branch.

Test like:
```
@implementation Foo
- (foo)foo {
}
@end
@implementation Bar
- (bar)bar {
}
@end
```
will distinguish version with `return` from one without. Therefore, I think we 
should add it.


Repository:
  rC Clang

https://reviews.llvm.org/D47095



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

Reply via email to