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: unassignedclangb...@nondot.org
          Reporter: dua...@vectorized.io
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to