]> granicus.if.org Git - clang/commit
[clang-format] Ignore UnbreakableTailLength sometimes during breaking
authorKrasimir Georgiev <krasimir@google.com>
Tue, 23 Jan 2018 11:26:19 +0000 (11:26 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Tue, 23 Jan 2018 11:26:19 +0000 (11:26 +0000)
commitee026abc72c6d68c7006f4252ba0b92ce23c661c
tree45b3c026e00f4edc670128a6a74aa4f39139ce7f
parent8e91672d17a53c06bb6fc3f72003bda3be768d9c
[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
lib/Format/BreakableToken.cpp
lib/Format/BreakableToken.h
lib/Format/ContinuationIndenter.cpp
unittests/Format/FormatTestTextProto.cpp