summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-05-27 08:59:34 +0000
committerDaniel Jasper <djasper@google.com>2016-05-27 08:59:34 +0000
commit99302edd1c63639204f0f1a8799384995dba4ca1 (patch)
tree6e825b13bb4886c3031c1eed8e24c4bf8cf1207b /clang/lib/Format
parent5fa681ee781dc41baf0813a778e73bd31bb8443b (diff)
downloadbcm5719-llvm-99302edd1c63639204f0f1a8799384995dba4ca1.tar.gz
bcm5719-llvm-99302edd1c63639204f0f1a8799384995dba4ca1.zip
clang-format: Allow splitting the line after /**/-comments.
While it might change the meaning of the comment in rare circumstances, it is better than violating the column limit. llvm-svn: 270975
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 2ddff47b930..e06b5de419d 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1826,6 +1826,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
return 500;
if (Left.isOneOf(tok::kw_class, tok::kw_struct))
return 5000;
+ if (Left.is(tok::comment))
+ return 1000;
if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon))
return 2;
@@ -2464,7 +2466,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
Left.getPrecedence() == prec::Assignment))
return true;
return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
- tok::kw_class, tok::kw_struct) ||
+ tok::kw_class, tok::kw_struct, tok::comment) ||
Right.isMemberAccess() ||
Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless,
tok::colon, tok::l_square, tok::at) ||
OpenPOWER on IntegriCloud