[llvm-bugs] [Bug 50809] New: clang-format does not indent the body of an else-comment-if correctly

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 22 15:41:38 PDT 2021


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

            Bug ID: 50809
           Summary: clang-format does not indent the body of an
                    else-comment-if correctly
           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

If there is a comment between "else" and "if", the "if" statement and its body
are indented incorrectly. See the example in LLVM style below.

Input:
if (foo)
  f();
else // comment
  if (bar) {
    g();
    h();
  }

Output:
if (foo)
  f();
else // comment
    if (bar) {
  g();
  h();
}

-- 
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/20210622/1368fe34/attachment.html>


More information about the llvm-bugs mailing list