[llvm-bugs] [Bug 25845] New: clang-format removes newlines before closing brace of a namespace (if there's no comment after it)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 15 17:18:06 PST 2015


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

            Bug ID: 25845
           Summary: clang-format removes newlines before closing brace of
                    a namespace (if there's no comment after it)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dcheng at google.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

I don't recall this happening in the past. Running clang-format with Chromium
style turns this:

namespace {

void f() {
  // Prevent collapsing to single line.
  int x = rand();
  int y = rand();
  return x * y;
}

}

into this:
namespace {

void f() {
  // Prevent collapsing to single line.
  int x = rand();
  int y = rand();
  return x * y;
}
}

The simple fix is to write:
namespace {

void f() {
  // Prevent collapsing to single line.
  int x = rand();
  int y = rand();
  return x * y;
}

}  // namespace

Which seems to disable the newline removal.

-- 
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/20151216/3af9c55d/attachment.html>


More information about the llvm-bugs mailing list