llvm-project/clang/unittests
Krasimir Georgiev 128fcffb06 [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
2018-10-25 07:39:30 +00:00
..
AST [ASTImporter] Added error handling for AST import. 2018-10-19 13:32:20 +00:00
ASTMatchers Revert "[ASTMatchers] Fix DynamicASTMatchersTests again" 2018-10-03 22:56:26 +00:00
Analysis [NFC] Declare instead of define non-void functions in unit tests. 2018-09-19 20:27:25 +00:00
Basic Lift VFS from clang to llvm (NFC) 2018-10-10 13:27:25 +00:00
CodeGen Unit tests for TBAA metadata generation. 2017-12-22 15:22:45 +00:00
CrossTU IWYU for llvm-config.h in clang. See r331124 for details. 2018-04-30 13:52:15 +00:00
Driver Lift VFS from clang to llvm (NFC) 2018-10-10 13:27:25 +00:00
Format [clang-format] Break before next parameter after a formatted multiline raw string parameter 2018-10-25 07:39:30 +00:00
Frontend [Fixed Point Arithmetic] Fix for FixedPointValueToString 2018-08-06 16:05:08 +00:00
Index Lift VFS from clang to llvm (NFC) 2018-10-10 13:27:25 +00:00
Lex Lift VFS from clang to llvm (NFC) 2018-10-10 13:27:25 +00:00
Rename Lift VFS from clang to llvm (NFC) 2018-10-10 13:27:25 +00:00
Rewrite [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
Sema [SemaCodeComplete] Make sure visited contexts are passed to completion results handler. 2018-07-04 10:01:18 +00:00
StaticAnalyzer Fix unittest build with GCC older than 5. 2018-06-28 13:31:36 +00:00
Tooling Make YAML quote forward slashes. 2018-10-12 16:31:20 +00:00
libclang Revert r336590 "[libclang] evalute compound statement cursors before trying to evaluate" 2018-07-10 19:49:07 +00:00
CMakeLists.txt [Index] Add an option to collect macros from preprocesor. 2018-09-18 08:51:08 +00:00