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

            Bug ID: 48231
           Summary: clang-format gets confused by nested blocks
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Created attachment 24185
  --> https://bugs.llvm.org/attachment.cgi?id=24185&action=edit
The code in question

As a result, the blocks are formatted incorrectly and the namespace-closing
comments are put in wrong places.

--- nested_blocks.cpp --
namespace A
{
namespace B
{
namespace C
{
void foo()
{
    {
        {
            bar();
        }
    }
    {
        baz();
    }
}

}
}
}
---

---
$ /home/brd/soft/llvm-11.0.0/bin/clang-format --version
clang-format version 11.0.0

$ cat nested_blocks.cpp | /home/brd/soft/llvm-11.0.0/bin/clang-format
--style=LLVM
namespace A {
namespace B {
namespace C {
void foo() { {{bar(); }
} // namespace C
{ baz(); }
} // namespace B

} // namespace A
}
}
---

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to