[llvm-bugs] [Bug 40115] New: Ignore new line in AlignConsecutiveDeclarations and AlignConsecutiveAssignments

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 20 06:09:26 PST 2018


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

            Bug ID: 40115
           Summary: Ignore new line in AlignConsecutiveDeclarations and
                    AlignConsecutiveAssignments
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Keywords: code-cleanup, code-quality
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: marcin.sus at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

It would be nice to have separate option to alter how
AlignConsecutiveDeclarations and AlignConsecutiveAssignments treat empty lines.

Now clang-format with both options enabled formats following code like this:

virtual std::string Test1(const double** pBuf) = 0;
virtual bool        Test2()                    = 0;
// empty line or comment
virtual void                    Test3(T t) = 0;
virtual std::vector<td::string> Test4(T t) = 0;

Sometimes you want to separate groups of methods with empty line (or comment)
but keep proper alignment across all declrations.

virtual std::string             Test1(const double** pBuf) = 0;
virtual bool                    Test2()                    = 0;
// empty line or coment
virtual void                    Test3(T t)                 = 0;
virtual std::vector<td::string> Test4(T t)                 = 0;

So in general format skiping empty lines (AlignConsecutiveLinesNumAllowed: n)

It would be very convenient to have it at least in class/struct declarations.

Can I modify clang-format to support this feature?

Thanks

-- 
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/20181220/d84822fd/attachment.html>


More information about the llvm-bugs mailing list