[llvm-bugs] [Bug 32928] New: clang-format produces ugly results after rearranging function arguments containing raw strings.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 4 11:50:29 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=32928

            Bug ID: 32928
           Summary: clang-format produces ugly results after rearranging
                    function arguments containing raw strings.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lukasza at chromium.org
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Given the following (manually formatted) snippet:

  test_app_dir.WriteManifest(
      base::StringPrintf(R"({
                           "name": "Hosted App vs TDI Test",
                           "version": "1",
                           "manifest_version": 2,
                           "app": {
                             "launch": {
                               "web_url": "%s"
                             },
                             "urls": ["*://app.site.com/frame_tree"]
                           }
                         })",
                         url.spec().c_str()));

clang-format changes it to:

  test_app_dir.WriteManifest(base::StringPrintf(R"({
                           "name": "Hosted App vs TDI Test",
                           "version": "1",
                           "manifest_version": 2,
                           "app": {
                             "launch": {
                               "web_url": "%s"
                             },
                             "urls": ["*://app.site.com/frame_tree"]
                           }
                         })",
                                                url.spec().c_str()));


I am not sure if the original formatting conforms to Google C++ Style Guide,
but I kind of like it.  I am sure that I dislike the result of clang-format -
the indent of the 2nd argument of base::StringPrintf seems wrong (even though
it is technically correct, by virtue of starting on the same column as the 1st
argument).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170504/e24cf2a8/attachment.html>


More information about the llvm-bugs mailing list