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 @@ -2482,7 +2482,8 @@ // return i + 1; // } if (Next->Next && Next->Next->is(tok::identifier) && - !(Next->MatchingParen->Next && Next->MatchingParen->Next->is(tok::semi))) + (!Next->MatchingParen->Next || + Next->MatchingParen->Next->is(tok::l_brace))) return true; for (const FormatToken *Tok = Next->Next; Tok && Tok != Next->MatchingParen; Tok = Tok->Next) { 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 @@ -8235,6 +8235,11 @@ " return a + b < c;\n" "}", Style); + // The return breaking style doesn't affect object definitions with + // attribute-like macros. + verifyFormat("Tttttttttttttttttttttttt ppppppppppppppp\n" + " ABSL_GUARDED_BY(mutex) = {};", + getGoogleStyleWithColumns(40)); Style = getGNUStyle();