[llvm-bugs] [Bug 36857] New: clang-format misformats code

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 21 11:39:17 PDT 2018


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

            Bug ID: 36857
           Summary: clang-format misformats code
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: redbeard0531 at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Config: https://github.com/mongodb/mongo/blob/master/.clang-format

Specific issues:

&& is has spaces on both sides when it should have none on left side (next line
is formatted correctly):
https://github.com/mongodb/mongo/blob/9799d8b7223205635ccb428bbec1ba4d947ba13b/src/mongo/util/future.h#L82
and
https://github.com/mongodb/mongo/blob/9799d8b7223205635ccb428bbec1ba4d947ba13b/src/mongo/util/future.h#L983

space between Type and *:
https://github.com/mongodb/mongo/blob/9799d8b7223205635ccb428bbec1ba4d947ba13b/src/mongo/util/future.h#L740-L741 

spaces inside [] of lambda capture:
https://github.com/mongodb/mongo/blob/9799d8b7223205635ccb428bbec1ba4d947ba13b/src/mongo/util/future.h#L1050

function signature indented too much:
https://github.com/mongodb/mongo/blob/9799d8b7223205635ccb428bbec1ba4d947ba13b/src/mongo/util/future.h#L940
(compare to
https://github.com/mongodb/mongo/blob/9799d8b7223205635ccb428bbec1ba4d947ba13b/src/mongo/util/future.h#L1005
which is indented correctly)


Our official code is formatted by clang-format 3.8, but I've also tried 5.0 and
today's trunk, but they seem to still have these issues. Most of our code is
formatted very nicely by clang-format, but something about this file causes it
to behave very strangely. While I only linked to 1 or 2 instances of each
issue, they all occur several times in that file.

-- 
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/20180321/0899592f/attachment.html>


More information about the llvm-bugs mailing list