[PATCH] D60558: [clang-format] Fix indent of trailing raw string param after newline

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 11 03:05:37 PDT 2019


krasimir created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Currently clang-format uses ContinuationIndent to indent the contents of a raw
string literal that is the last parameter of the function call. This is to
achieve formatting similar to trailing:

  f(1, 2, R"pb(
      x: y)pb");

However this had the unfortunate consequence of producing format like this:

  fffffff(1, 2,
          R"pb(
      a: b
          )pb");

This patch makes clang-format consider indenting a trailing raw string param
after a newline based off the start of the format delimiter, producing:

  fffffff(1, 2,
          R"pb(
            a: b
          )pb");


Repository:
  rC Clang

https://reviews.llvm.org/D60558

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60558.194654.patch
Type: text/x-patch
Size: 5198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190411/df95e5b0/attachment.bin>


More information about the cfe-commits mailing list