diff options
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r-- | lib/Format/Format.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 108ae7a736..f8e185086d 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -1390,6 +1390,13 @@ private: // change the "binding" behavior of a comment. return false; + // Allow breaking after a trailing 'const', e.g. after a method declaration, + // unless it is follow by ';', '{' or '='. + if (Left.is(tok::kw_const) && Left.Parent != NULL && + Left.Parent->is(tok::r_paren)) + return Right.isNot(tok::l_brace) && Right.isNot(tok::semi) && + Right.isNot(tok::equal); + // We only break before r_brace if there was a corresponding break before // the l_brace, which is tracked by BreakBeforeClosingBrace. if (Right.is(tok::r_brace)) |