[PATCH] D42372: [clang-format] Ignore UnbreakableTailLength sometimes during breaking

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 06:51:55 PST 2018


krasimir created this revision.
Herald added subscribers: cfe-commits, klimek.

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`.


Repository:
  rC Clang

https://reviews.llvm.org/D42372

Files:
  lib/Format/BreakableToken.cpp
  lib/Format/BreakableToken.h
  lib/Format/ContinuationIndenter.cpp
  unittests/Format/FormatTestRawStrings.cpp
  unittests/Format/FormatTestTextProto.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42372.130880.patch
Type: text/x-patch
Size: 8816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180122/26dd2930/attachment.bin>


More information about the cfe-commits mailing list