[llvm-bugs] [Bug 37919] New: AlignConsecutiveAssignments interferes with UseTab: ForIndentation (indents with spaces instead)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 24 14:04:45 PDT 2018


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

            Bug ID: 37919
           Summary: AlignConsecutiveAssignments interferes with UseTab:
                    ForIndentation (indents with spaces instead)
           Product: clang
           Version: 6.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sami at boukortt.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 20463
  --> https://bugs.llvm.org/attachment.cgi?id=20463&action=edit
The expected output for the aforementioned input (and for itself).

With this .clang-format:

    TabWidth: 2
    IndentWidth: 2
    ContinuationIndentWidth: 2
    UseTab: ForIndentation
    AlignConsecutiveAssignments: true
    ColumnLimit: 0

and this input:

    int main() {
            const int a_long_name = 42;

            const auto f = [](const int n) {
                    return n + 1;
            };
    }

clang-format produces the expected output, indented with tabs (here printed
with width 8):

    int main() {
    |------>const int a_long_name = 42;

    |------>const auto f = [](const int n) {
    |------>|------>return n + 1;
    |------>};
    }

However, if the blank line between the two variables is removed so that their
assignments are aligned, then the body of the lambda expression is indented
with spaces instead. It is not obvious if the code is rendered with tabs of
width 2, but with 8-column-wide tabs, it looks like this:

    int main() {
    |------>const int a_long_name = 42;
    |------>const auto f          = [](const int n) {
    ····return n + 1;
    |------>};
    }

-- 
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/20180624/3b5bbff7/attachment-0001.html>


More information about the llvm-bugs mailing list