diff options
author | Daniel Jasper <djasper@google.com> | 2016-01-11 11:01:05 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-01-11 11:01:05 +0000 |
commit | 06ca0fc69d9dc91e8ce0cfaf68871f2995c13b8c (patch) | |
tree | 10dff339dbe079a3cf3c0b907357ff80c0eb3fba /clang/lib/Format | |
parent | 2802456097eec57d663c9a53349eb408080ab7af (diff) | |
download | bcm5719-llvm-06ca0fc69d9dc91e8ce0cfaf68871f2995c13b8c.tar.gz bcm5719-llvm-06ca0fc69d9dc91e8ce0cfaf68871f2995c13b8c.zip |
clang-format: Slightly row back on r257257.
r257257 change the way clang-format enforces line breaks after a
templated type has been line-wrapped. This was to fix an incorrect line
break if BinPackParameters is set to false. However, it also leads to
an unwanted line break in a different case. Thus, for now, only do this
when BinPackParameters is false. This isn't ideal yet, but helps us
until we have a better solution.
With BinPackParameters:
Before:
void fffffffffff(aaaaaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaa> aaaaaaaaaa);
After:
void fffffffffff(
aaaaaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaa>
aaaaaaaaaa);
llvm-svn: 257325
Diffstat (limited to 'clang/lib/Format')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index cb5999e60ef..a6a5a1d809f 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -151,7 +151,11 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { return true; if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) || (Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName) && - Previous.NestingLevel == 1) || + // FIXME: This is a temporary workaround for the case where clang-format + // sets BreakBeforeParameter to avoid bin packing and this creates a + // completely unnecessary line break after a template type that isn't + // line-wrapped. + (Previous.NestingLevel == 1 || Style.BinPackParameters)) || (Style.BreakBeforeTernaryOperators && Current.is(TT_ConditionalExpr) && Previous.isNot(tok::question)) || (!Style.BreakBeforeTernaryOperators && |