[clang-format] Break before next parameter after a formatted multiline raw string...
authorKrasimir Georgiev <krasimir@google.com>
Thu, 25 Oct 2018 07:39:30 +0000 (07:39 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Thu, 25 Oct 2018 07:39:30 +0000 (07:39 +0000)
commit128fcffb062789a77d65ce2966ffa0ef718e3d47
tree60f1836ce244466d669fbe6622332926ccb955c1
parent7ae43cad6525cb3f2be2046cfd780ae65cb9a09a
[clang-format] Break before next parameter after a formatted multiline raw string parameter

Summary:
Currently clang-format breaks before the next parameter after multiline parameters (also recursively for the parent expressions of multiline parameters). However, it fails to do so for formatted multiline raw string literals:
```
$ cat test.cc
// Examples

// Regular multiline tokens
int x = f(R"(multi
             line)", 2);
}

int y = g(h(R"(multi
              line)"), 2);

// Formatted multiline tokens
int z = f(R"pb(multi: 1  #
               line: 2)pb", 2);

int w = g(h(R"pb(multi: 1  #
                 line: 2)pb"), 2);
$ clang-format -style=google test.cc
// Examples

// Regular multiline tokens
int x = f(R"(multi
             line)",
          2);
}

int y = g(h(R"(multi
              line)"),
          2);

// Formatted multiline tokens
int z = f(R"pb(multi: 1  #
               line: 2)pb", 2);

int w = g(h(R"pb(multi: 1  #
                 line: 2)pb"), 2);
```

This patch addresses this inconsistency by forcing breaking after multiline formatted raw string literals. This requires a little tweak to the indentation chosen for the contents of a formatted raw string literal: in case when that's a parameter and not the last one, the indentation is based off of the uniform indentation of all of the parameters.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D52448

llvm-svn: 345242
clang/lib/Format/ContinuationIndenter.cpp
clang/unittests/Format/FormatTestRawStrings.cpp