Format @autoreleasepool properly for the Attach brace style
by recognizing @autoreleasepool as a block introducer.
Details
Diff Detail
Event Timeline
Oh, sorry, there is one, phab just doesn't show it (and didn't mail it)
'cause it thinks FormatTest.cpp is a binary file (?)
I can't see the changes to tests at the moment. Trying to fix that issue with SVN/Phabricator (it's unrelated to you patch).
The case body is mostly the same as for case tok::objc_synchronized – could they share the same code? (the paren code would just never run for autoreleasepool)
The case body is mostly the same as for case tok::objc_synchronized – could they share the same code? (the paren code would just never run for autoreleasepool)
The same could be said for while and maybe if and for, too.
Testing @autoreleasepool (foo) { and not testing @autoreleasepool { doesn't make sense anyway.
lib/Format/UnwrappedLineParser.cpp | ||
---|---|---|
659 | (I think this is also what Nico means): Join this case and the next. I think it makes sense to format "@autoreleasepool (foo) {" like @synchronized, even if it might not be valid syntax. If you care about not having parens here, extend the corresponding if-statement. |
lib/Format/UnwrappedLineParser.cpp | ||
---|---|---|
659 | Ah, I thought Nico was talking about the test cases, not this switch. I agree. |
(I think this is also what Nico means): Join this case and the next. I think it makes sense to format "@autoreleasepool (foo) {" like @synchronized, even if it might not be valid syntax. If you care about not having parens here, extend the corresponding if-statement.