diff options
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 2f1aae39344..0117f222004 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1539,8 +1539,11 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) { Current->MustBreakBefore = Current->MustBreakBefore || mustBreakBefore(Line, *Current); - if (Style.AlwaysBreakAfterDefinitionReturnType && InFunctionDecl && - Current->is(TT_FunctionDeclarationName) && + if ((Style.AlwaysBreakAfterDefinitionReturnType == FormatStyle::DRTBS_All || + (Style.AlwaysBreakAfterDefinitionReturnType == + FormatStyle::DRTBS_TopLevel && + Line.Level == 0)) && + InFunctionDecl && Current->is(TT_FunctionDeclarationName) && !Line.Last->isOneOf(tok::semi, tok::comment)) // Only for definitions. // FIXME: Line.Last points to other characters than tok::semi // and tok::lbrace. |