diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-01-23 11:26:19 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-01-23 11:26:19 +0000 |
commit | ee026abc72c6d68c7006f4252ba0b92ce23c661c (patch) | |
tree | 45b3c026e00f4edc670128a6a74aa4f39139ce7f /lib/Format/BreakableToken.h | |
parent | 8e91672d17a53c06bb6fc3f72003bda3be768d9c (diff) |
[clang-format] Ignore UnbreakableTailLength sometimes during breaking
Summary:
This patch fixes an issue where the UnbreakableTailLength would be counted towards
the length of a token during breaking, even though we can break after the token.
For example, this proto text with column limit 20
```
# ColumnLimit: 20 V
foo: {
bar: {
bazoo: "aaaaaaa"
}
}
```
was broken:
```
# ColumnLimit: 20 V
foo: {
bar: {
bazoo:
"aaaaaaa"
}
}
```
because the 2 closing `}` were counted towards the string literal's `UnbreakableTailLength`.
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D42376
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/BreakableToken.h')
-rw-r--r-- | lib/Format/BreakableToken.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Format/BreakableToken.h b/lib/Format/BreakableToken.h index 8ef26ef464..eba48f75e8 100644 --- a/lib/Format/BreakableToken.h +++ b/lib/Format/BreakableToken.h @@ -238,8 +238,8 @@ public: /// after formatting. BreakableStringLiteral(const FormatToken &Tok, unsigned StartColumn, StringRef Prefix, StringRef Postfix, - bool InPPDirective, encoding::Encoding Encoding, - const FormatStyle &Style); + unsigned UnbreakableTailLength, bool InPPDirective, + encoding::Encoding Encoding, const FormatStyle &Style); Split getSplit(unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit, unsigned ReflowColumn, |