[llvm-bugs] [Bug 41945] New: Bad continuation indent with return and function chaining

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 20 08:23:57 PDT 2019


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

            Bug ID: 41945
           Summary: Bad continuation indent with return and function
                    chaining
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: duarte at vectorized.io
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

My style produces the following formatting:

int foo1() {
    bar(
      aaaaaaaaaaaaa,
      bbbbbbbbbbbbbbb,
      cccccccccccccccc,
      ddddddddd,
      eeeeeeeeeeeee);
    return bar(
      aaaaaaaaaaaaa,
      bbbbbbbbbbbbbbb,
      cccccccccccccccc,
      ddddddddd,
      eeeeeeeeeeeee);
}

int foo2() {
    bar(
      aaaaaaaaaaaaa,
      bbbbbbbbbbbbbbb,
      cccccccccccccccc,
      ddddddddd,
      eeeeeeeeeeeee)
      .baz(xxxxx, yyyyy);
    return bar(
             aaaaaaaaaaaaa,
             bbbbbbbbbbbbbbb,
             cccccccccccccccc,
             ddddddddd,
             eeeeeeeeeeeee)
      .baz(xxxxx, yyyyy);
}

Notice how in foo2(), the last call to "bar" has incorrect continuation
indentation. This happens consistently for functions calls preceded by "return"
and with a chained function call.

.clang-format is:

BasedOnStyle: Mozilla
Language: Cpp
AccessModifierOffset: -4
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
BreakBeforeBraces: Attach
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
FixNamespaceComments: true
IndentCaseLabels: false
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
PenaltyReturnTypeOnItsOwnLine: 60

-- 
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/20190520/45405e5d/attachment.html>


More information about the llvm-bugs mailing list