Index: lib/Format/TokenAnnotator.cpp =================================================================== --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -694,8 +694,9 @@ } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { Contexts.back().IsExpression = true; } else if (Current.is(tok::l_paren) && !Line.MustBeDeclaration && - !Line.InPPDirective && Current.Previous && - Current.Previous->isNot(tok::kw_decltype)) { + !Line.InPPDirective && + (!Current.Previous || + Current.Previous->isNot(tok::kw_decltype))) { bool ParametersOfFunctionType = Current.Previous && Current.Previous->is(tok::r_paren) && Current.Previous->MatchingParen && Index: unittests/Format/FormatTest.cpp =================================================================== --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -4740,6 +4740,8 @@ verifyFormat("return (my_int)aaa;"); verifyFormat("#define x ((int)-1)"); verifyFormat("#define p(q) ((int *)&q)"); + verifyFormat("DEBUG(dbgs() << \"test msg\"; (void)F;)"); + verifyFormat("void foo() {\n assert(t && \"assert msg\");\n (void)F;\n}"); verifyFormat("void f() { my_int a = (my_int)*b; }"); verifyFormat("void f() { return P ? (my_int)*P : (my_int)0; }");