Index: cfe/trunk/lib/Format/TokenAnnotator.cpp =================================================================== --- cfe/trunk/lib/Format/TokenAnnotator.cpp +++ cfe/trunk/lib/Format/TokenAnnotator.cpp @@ -2349,6 +2349,9 @@ if (Right.is(tok::l_paren) && Line.MustBeDeclaration && Left.Tok.getIdentifierInfo()) return false; + if (Right.is(tok::l_paren) && + Left.isOneOf(tok::kw_throw, Keywords.kw_await, tok::kw_void)) + return true; if ((Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in, tok::kw_const) || // "of" is only a keyword if it appears after another identifier Index: cfe/trunk/unittests/Format/FormatTestJS.cpp =================================================================== --- cfe/trunk/unittests/Format/FormatTestJS.cpp +++ cfe/trunk/unittests/Format/FormatTestJS.cpp @@ -259,6 +259,15 @@ "}\n"); } +TEST_F(FormatTestJS, ReservedWordsParenthesized) { + // All of these are statements using the keyword, not function calls. + verifyFormat("throw (x + y);\n" + "await (await x).y;\n" + "void (0);\n" + "delete (x.y);\n" + "return (x);\n"); +} + TEST_F(FormatTestJS, CppKeywords) { // Make sure we don't mess stuff up because of C++ keywords. verifyFormat("return operator && (aa);");