diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 77fba1fbf1ca0111e67508e7633a1b5e3e956e03..5140639d009b60609a94a71704346f6393513d50 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -994,7 +994,7 @@ private: Tok.Parent->is(tok::comma) || Tok.Parent->is(tok::l_square) || Tok.Parent->is(tok::question) || Tok.Parent->is(tok::colon) || Tok.Parent->is(tok::kw_return) || Tok.Parent->is(tok::kw_case) || - Tok.Parent->is(tok::at)) + Tok.Parent->is(tok::at) || Tok.Parent->is(tok::l_brace)) return TT_UnaryOperator; // There can't be to consecutive binary operators. diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 061ac5710d629b208961a63df54ad04ebeccbf4c..9106a1fc7f3173af3918b76a737d1a177d966f84 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -956,6 +956,9 @@ TEST_F(FormatTest, UnderstandsUnaryOperators) { "case -1:\n" " break;\n" "}"); + + verifyFormat("const NSPoint kBrowserFrameViewPatternOffset = { -5, +3 };"); + verifyFormat("const NSPoint kBrowserFrameViewPatternOffset = { +5, -3 };"); } TEST_F(FormatTest, UndestandsOverloadedOperators) {