[llvm-bugs] [Bug 32271] New: merge and split include categories
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Tue Mar 14 15:16:10 PDT 2017
    
    
  
https://bugs.llvm.org/show_bug.cgi?id=32271
            Bug ID: 32271
           Summary: merge and split include categories
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: daniel.pfeifer at mailbox.org
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
Created attachment 18092
  --> https://bugs.llvm.org/attachment.cgi?id=18092&action=edit
Possible implementation
Currently, the #include directives in each block of includes are sorted by
category and then alphabetically.  However, it is very common to have a block
of includes per category.  Eg first the associated header, an empty line, then
all standard headers, another empty line, then all custom headers.  If a
standard header is appended to the block of custom headers, clang-format will
keep it in that block.
Here is a question about that:
https://stackoverflow.com/questions/36687598/clang-format-groups-and-empty-lines
The "fix" is simple: When collecting the includes, ignore empty lines. When
writing the sorted list of includes, insert an empty line after each category.
I cannot decide, whether that should be the default behavior or whether this
should be enabled by some config option.  Please see the attached patch for a
possible implementation.
-- 
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/20170314/81d8ba63/attachment.html>
    
    
More information about the llvm-bugs
mailing list