[llvm-bugs] [Bug 34655] New: Bad operator formatting - strange indentation

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 18 07:44:05 PDT 2017


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

            Bug ID: 34655
           Summary: Bad operator formatting - strange indentation
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: acieszkiel at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

clang-format config:
Language: Cpp
AlignOperands: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
ColumnLimit: 120
ContinuationIndentWidth: 4
IndentWidth: 4
SpaceBeforeAssignmentOperators: true
TabWidth: 4
UseTab: Never

// BEFORE:
#include <cstdint>

typedef uint8_t SomeType;

SomeType someVar;
SomeType someOtherVar;
uint64_t someYetAnotherVar;
int64_t someDiff;

int main()
{
    SomeType first = static_cast<SomeType>((((static_cast<int64_t>(someVar) +
static_cast<int64_t>(someOtherVar))
        * static_cast<int64_t>(someYetAnotherVar) + someDiff) /
static_cast<int64_t>(someYetAnotherVar))
        % static_cast<int64_t>(someOtherVar));

    return 0;
}

// AFTER:
#include <cstdint>

typedef uint8_t SomeType;

SomeType someVar;
SomeType someOtherVar;
uint64_t someYetAnotherVar;
int64_t someDiff;

int main() {
    SomeType first = static_cast<SomeType>((((static_cast<int64_t>(someVar) +
static_cast<int64_t>(someOtherVar)) *
                                                
static_cast<int64_t>(someYetAnotherVar) +
                                             someDiff) /
                                           
static_cast<int64_t>(someYetAnotherVar)) %
                                           static_cast<int64_t>(someOtherVar));

    return 0;
}

Why the subsequent lines are so strangely indented?

-- 
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/20170918/edc3cddc/attachment.html>


More information about the llvm-bugs mailing list