]> granicus.if.org Git - clang/commit
clang-format: Fix string literal breaking.
authorDaniel Jasper <djasper@google.com>
Fri, 12 Jul 2013 11:37:05 +0000 (11:37 +0000)
committerDaniel Jasper <djasper@google.com>
Fri, 12 Jul 2013 11:37:05 +0000 (11:37 +0000)
commit0fde9504af582459c93c43363db2680bcd726126
tree5b3a9499b68adf131d0911ab251e8be7a834bbce
parent011c35dabb4c8abcb7389d8fbc6316f8f23576ab
clang-format: Fix string literal breaking.

Before this patch, it did not cooperate with
Style::AlwaysBreakBeforeMultilineStrings. Thus, it would turn

  aaaaaaaaaaaa(aaaaaaaaaaaaa, "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa");

into:

  aaaaaaaaaaaa(aaaaaaaaaaaaa, "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa "
                              "aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa");

and only a second format step would lead to the desired (with that
option):

  aaaaaaaaaaaa(aaaaaaaaaaaaa,
               "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa "
               "aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa");

This could even lead to clang-format breaking the string at a different
character and thus leading to a completely different end result.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186154 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/Format.cpp
unittests/Format/FormatTest.cpp