diff options
author | Jacek Olesiak <jolesiak@google.com> | 2018-05-30 12:57:58 +0000 |
---|---|---|
committer | Jacek Olesiak <jolesiak@google.com> | 2018-05-30 12:57:58 +0000 |
commit | d8d5628834c7cda4a506a3c33105c8725b9b1762 (patch) | |
tree | d8c2197b1126775dccb7f843c331f305b024a4a4 /clang/lib | |
parent | 28f048af9db8540fb3c4a6b1cd1770a0dbb6cc3b (diff) | |
download | bcm5719-llvm-d8d5628834c7cda4a506a3c33105c8725b9b1762.tar.gz bcm5719-llvm-d8d5628834c7cda4a506a3c33105c8725b9b1762.zip |
Revert "[clang-format] Fix putting ObjC message arguments in one line for multiline receiver"
Summary:
This reverts commit db9e5e9a616d7fdd4d1ba4c3b2cd89d8a0238533 (rC333171).
Mentioned change introduced unintended formatting of ObjC code due to split priorities inherited from C/C++, e.g.:
```
fooooooo = [
[obj fooo] aaa:42 aaa:42];
```
instead of
```
fooooooo =
[[obj fooo] aaa:42
aaa:42];
```
when formatted with ColumnLimit = 30.
Reviewers: krasimir
Reviewed By: krasimir
Subscribers: benhamilton, klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D47527
llvm-svn: 333539
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index ac871471d9d..eacdfdc6e05 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -1387,29 +1387,6 @@ void ContinuationIndenter::moveStatePastScopeCloser(LineState &State) { (Current.is(tok::greater) && Current.is(TT_DictLiteral)))) State.Stack.pop_back(); - // Reevaluate whether ObjC message arguments fit into one line. - // If a receiver spans multiple lines, e.g.: - // [[object block:^{ - // return 42; - // }] a:42 b:42]; - // BreakBeforeParameter is calculated based on an incorrect assumption - // (it is checked whether the whole expression fits into one line without - // considering a line break inside a message receiver). - // We check whether arguements fit after receiver scope closer (into the same - // line). - if (Current.MatchingParen && Current.MatchingParen->Previous) { - const FormatToken &CurrentScopeOpener = *Current.MatchingParen->Previous; - if (CurrentScopeOpener.is(TT_ObjCMethodExpr) && - CurrentScopeOpener.MatchingParen) { - int NecessarySpaceInLine = - getLengthToMatchingParen(CurrentScopeOpener, State.Stack) + - CurrentScopeOpener.TotalLength - Current.TotalLength - 1; - if (State.Column + Current.ColumnWidth + NecessarySpaceInLine <= - Style.ColumnLimit) - State.Stack.back().BreakBeforeParameter = false; - } - } - if (Current.is(tok::r_square)) { // If this ends the array subscript expr, reset the corresponding value. const FormatToken *NextNonComment = Current.getNextNonComment(); |