diff options
author | Daniel Jasper <djasper@google.com> | 2013-10-09 15:06:17 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-10-09 15:06:17 +0000 |
commit | d3e014d4046e875d14fdcb2298c8f555c4a7e941 (patch) | |
tree | aa03df4e6fc80b8d1116a479d4bb83f048dbb85a /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 76a3c33d417598111a0f1ffb1143b2d5603ef914 (diff) | |
download | bcm5719-llvm-d3e014d4046e875d14fdcb2298c8f555c4a7e941.tar.gz bcm5719-llvm-d3e014d4046e875d14fdcb2298c8f555c4a7e941.zip |
clang-format: Fix template declaration line breaking with comment.
Before, clang-format would always insert a linebreak before the comment
in code like:
template <typename T> // T can be A, B or C.
struct S {};
llvm-svn: 192297
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 3714088306c..560e65ea684 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -178,7 +178,8 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { State.Stack.back().BreakBeforeParameter) return true; if ((Current.Type == TT_CtorInitializerColon || - (Previous.ClosesTemplateDeclaration && State.ParenLevel == 0))) + (Previous.ClosesTemplateDeclaration && State.ParenLevel == 0 && + !Current.isTrailingComment()))) return true; if ((Current.Type == TT_StartOfName || Current.is(tok::kw_operator)) && |