[llvm-bugs] [Bug 42509] New: Inconsistent output when running clang-format twice

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 4 07:04:41 PDT 2019


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

            Bug ID: 42509
           Summary: Inconsistent output when running clang-format twice
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: beginner
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tomasz.g.markiewicz at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Single runs and double runs of the `clang-format' are not consistent between
themselves. See the example below.

file: example.cc:
--------------------------
void foo() {
    /* Empty */
}

Single run
----------------------------
$ style=LLVM; cat example.cc | clang-format --style=${style}

Result:
void foo() { /* Empty */ }


Double run
----------------------------
$ style=LLVM; cat example.cc | clang-format --style=${style} | clang-format
--style=${style}

Result:
void foo() { /* Empty */
}

The same is for style=Google.

Mozilla, Chromium and WebKit styles (obviously) work fine. (These probably do
not merge an empty function into one line.)

Version:
----------------
$ clang-format --version
clang-format version 9.0.0 (https://github.com/llvm-mirror/clang.git
b5cfeee0a6e73044cc755e2ab08145056b2d3fd4)
(https://github.com/llvm-mirror/llvm.git
57b4161e8fc497386cebf223cb8a26896303cb05)

-- 
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/20190704/8cc9cae2/attachment.html>


More information about the llvm-bugs mailing list