diff options
author | Daniel Jasper <djasper@google.com> | 2014-01-13 14:10:04 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-01-13 14:10:04 +0000 |
commit | f6c7c18b8ef1691688cebebe5af71aa4502fc3ba (patch) | |
tree | 9a2fd2a92db366f265bf7f995a6953b793b239f5 /clang/lib | |
parent | 4e033b0e92aeb529e36b7390e9ab6e4d3b9eb90a (diff) | |
download | bcm5719-llvm-f6c7c18b8ef1691688cebebe5af71aa4502fc3ba.tar.gz bcm5719-llvm-f6c7c18b8ef1691688cebebe5af71aa4502fc3ba.zip |
clang-format: Fix corner case with comment in ctor initializer.
Formatting:
Constructor() :
// Comment forcing unwanted break.
aaaa(aaaa) {}
Before:
Constructor()
:
// Comment forcing unwanted break.
aaaa(aaaa) {}
After:
Constructor()
: // Comment forcing unwanted break.
aaaa(aaaa) {}
llvm-svn: 199107
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 1c580c420db..1584a052415 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1436,6 +1436,7 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, const FormatToken &Right) { if (Right.is(tok::comment)) { return Right.Previous->BlockKind != BK_BracedInit && + Right.Previous->Type != TT_CtorInitializerColon && Right.NewlinesBefore > 0; } else if (Right.Previous->isTrailingComment() || (Right.isStringLiteral() && Right.Previous->isStringLiteral())) { |