diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2400,6 +2400,8 @@ return true; for (const FormatToken *Tok = Next->Next; Tok && Tok != Next->MatchingParen; Tok = Tok->Next) { + if (Tok->is(TT_TypeDeclarationParen)) + return true; if (Tok->isOneOf(tok::l_paren, TT_TemplateOpener) && Tok->MatchingParen) { Tok = Tok->MatchingParen; continue; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -6681,9 +6681,12 @@ Style); // All declarations and definitions should have the return type moved to its - // own - // line. + // own line. Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_All; + Style.TypenameMacros = {"LIST"}; + verifyFormat("SomeType\n" + "funcdecl(LIST(uint64_t));", + Style); verifyFormat("class E {\n" " int\n" " f() {\n"