[llvm-bugs] [Bug 38525] New: incorrectly adds extra continuation indent spaces with BreakBeforeBinaryOperators set to All

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 10 18:48:03 PDT 2018


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

            Bug ID: 38525
           Summary: incorrectly adds extra continuation indent spaces with
                    BreakBeforeBinaryOperators set to All
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: owenpiano at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 20675
  --> https://bugs.llvm.org/attachment.cgi?id=20675&action=edit
test case

Command line:
clang-format -style="{IndentWidth: 4, TabWidth: 4, UseTab: Always,
AlignAfterOpenBracket: DontAlign, AlignOperands: false,
BreakBeforeBinaryOperators: All}" BreakBeforeBinaryOperators.cpp

Output with incorrectly added extra spaces before "||":
bool BreakBeforeBinaryOperators(
        bool someVeryVeryLongConditionThatBarelyFitsOnALine,
        bool someOtherLongishConditionPart1,
        bool someOtherEvenLongerNestedConditionPart2) {
        return someVeryVeryLongConditionThatBarelyFitsOnALine
                && (someOtherLongishConditionPart1
                           || someOtherEvenLongerNestedConditionPart2);
}

Expected output:
bool BreakBeforeBinaryOperators(
        bool someVeryVeryLongConditionThatBarelyFitsOnALine,
        bool someOtherLongishConditionPart1,
        bool someOtherEvenLongerNestedConditionPart2) {
        return someVeryVeryLongConditionThatBarelyFitsOnALine
                && (someOtherLongishConditionPart1
                        || someOtherEvenLongerNestedConditionPart2);
}

-- 
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/20180811/bed00257/attachment-0001.html>


More information about the llvm-bugs mailing list