[llvm-bugs] [Bug 48253] New: clang-format doesn't respect BreakConstructorInitializers setting

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Nov 21 14:46:19 PST 2020


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

            Bug ID: 48253
           Summary: clang-format doesn't respect
                    BreakConstructorInitializers setting
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: legalize at xmission.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 24193
  --> https://bugs.llvm.org/attachment.cgi?id=24193&action=edit
.clang-format

The "BeforeColon" setting of BreakConstructorInitializers is described in 11.0
documentation as inserting a line break before the colon of an
initializer list, but this isn't working.  Example transcript below.
Source code used in this test is on github at
https://github.com/legalizeadulthood/refactor-test-suite
commit 1cf5c07c500907817caf769a612a67b744f76e5b

D:\legalize\refactor-test-suite\src\RefactorTest
> clang-format --version
clang-format version 11.0.0

D:\legalize\refactor-test-suite\src\RefactorTest
> clang-format -i AddOverride.cpp

D:\legalize\refactor-test-suite\src\RefactorTest
> git diff AddOverride.cpp
diff --git a/RefactorTest/AddOverride.cpp b/RefactorTest/AddOverride.cpp
index 998ac2c..8fb96e7 100644
--- a/RefactorTest/AddOverride.cpp
+++ b/RefactorTest/AddOverride.cpp
@@ -8,7 +8,9 @@
 class Interface
 {
 public:
-    virtual ~Interface() { }
+    virtual ~Interface()
+    {
+    }

     virtual void Method() = 0;

@@ -20,11 +22,13 @@ public:
 class Implementation : public Interface
 {
 public:
-    Implementation()
-        : value_(0)
-    { }
+    Implementation() : value_(0)
+    {
+    }

-    virtual ~Implementation() { }
+    virtual ~Implementation()
+    {
+    }

     // #TEST#: AO1 Add override
     virtual void Method()
@@ -56,13 +60,13 @@ private:
 class AbstractImplementation : public Interface
 {
 public:
-    AbstractImplementation()
-        : value_(0)
+    AbstractImplementation() : value_(0)
     {
     }

     virtual ~AbstractImplementation()
-    {}
+    {
+    }

     virtual int Getter() const override
     {
@@ -81,12 +85,13 @@ private:
 class DerivedImplementation : public AbstractImplementation
 {
 public:
-    DerivedImplementation()
-        : AbstractImplementation()
-    {}
+    DerivedImplementation() : AbstractImplementation()
+    {

D:\legalize\refactor-test-suite\src\RefactorTest
> find "BreakConstructorInitializers" ..\.clang-format

---------- ..\.CLANG-FORMAT
BreakConstructorInitializers: BeforeColon

D:\legalize\refactor-test-suite\src\RefactorTest
>

-- 
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/20201121/a441889c/attachment.html>


More information about the llvm-bugs mailing list