[llvm-bugs] [Bug 45657] New: Bad comment indentation before ifdef after braceless if

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 24 00:28:23 PDT 2020


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

            Bug ID: 45657
           Summary: Bad comment indentation before ifdef after braceless
                    if
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hans at chromium.org
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Example input:

$ cat /tmp/a.cc
void f() {
  if (foo)
    bar();
  // Comment
#if BAZ
  baz();
#endif
}

Example output:

$ bin/clang-format < /tmp/a.cc
void f() {
  if (foo)
    bar();
    // Comment
#if BAZ
  baz();
#endif
}

Note that the comment is now overly indented. Inserting a new line after
"baz()" doesn't change it.

(I was using clang-format built from d254b50b2b5b22368780c6003c419ffa1e23fa93)

This was originally filed in Chromium:
https://bugs.chromium.org/p/chromium/issues/detail?id=1074113

-- 
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/20200424/f2dc8188/attachment.html>


More information about the llvm-bugs mailing list