This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix indent of trailing raw string param after newline
ClosedPublic

Authored by krasimir on Apr 11 2019, 3:04 AM.

Details

Summary

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");

Diff Detail

Repository
rC Clang

Event Timeline

krasimir created this revision.Apr 11 2019, 3:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2019, 3:04 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
krasimir edited reviewers, added: djasper; removed: ioeric.Apr 11 2019, 10:43 AM
djasper accepted this revision.Apr 18 2019, 7:32 AM

Looks good. Thank you.

This revision is now accepted and ready to land.Apr 18 2019, 7:32 AM
This revision was automatically updated to reflect the committed changes.