[llvm-bugs] [Bug 39883] New: #ifdef followed by constructor results in wrong code

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 4 17:17:59 PST 2018


            Bug ID: 39883
           Summary: #ifdef followed by constructor results in wrong code
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: s6jaschu at uni-bonn.de
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

The following code is scrambled after formatting it with clang-format:

namespace a {

class A {
  void foo() {
    { randomize(); }

  A() {}

} // namespace a

When the constructor "A() { }" or the brackets around "randomize();" are
removed the formatting is as expected. (The brackets are there, because I have
a #pragma for the block.)

clang-format --version
clang-format version 8.0.0 (tags/google/stable/2018-10-04)

Content of .clang-format:

BasedOnStyle: Chromium

Language: Cpp
AlignConsecutiveAssignments: true
AlignOperands: true
FixNamespaceComments: true

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/20181205/00bef8d6/attachment.html>

More information about the llvm-bugs mailing list