diff options
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 5 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index c6b491914b3..c5315e72600 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -637,9 +637,8 @@ private: // there is also an identifier before the (). if (LeftOfParens && (LeftOfParens->Tok.getIdentifierInfo() == NULL || LeftOfParens->is(tok::kw_return)) && - LeftOfParens->Type != TT_TemplateCloser && - LeftOfParens->Type != TT_ObjCMethodExpr && Current.Next && - (Current.Next->is(tok::identifier))) + LeftOfParens->Type != TT_TemplateCloser && Current.Next && + Current.Next->is(tok::identifier)) IsCast = true; if (IsCast && !ParensAreEmpty) Current.Type = TT_CastRParen; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 839d9ec0be3..6b1d2d3f400 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -4309,6 +4309,10 @@ TEST_F(FormatTest, FormatObjCMethodExpr) { verifyFormat("throw [self errorFor:a];"); verifyFormat("@throw [self errorFor:a];"); + verifyFormat("[(id)foo bar:(id)baz quux:(id)snorf];"); + verifyFormat("[(id)foo bar:(id) ? baz : quux];"); + verifyFormat("4 > 4 ? (id)a : (id)baz;"); + // This tests that the formatter doesn't break after "backing" but before ":", // which would be at 80 columns. verifyFormat( |

