[PATCH] D64695: [clang-format] Added new style rule: SortNetBSDIncludes
Manikishan Ghantasala via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 15 09:31:36 PDT 2019
Manikishan added a comment.
In D64695#1585835 <https://reviews.llvm.org/D64695#1585835>, @lebedev.ri wrote:
> In D64695#1585772 <https://reviews.llvm.org/D64695#1585772>, @Manikishan wrote:
>
> > In D64695#1585754 <https://reviews.llvm.org/D64695#1585754>, @rdwampler wrote:
> >
> > > I am not quite sure why this change is required to sort the headers for NetBSD, you can set the priorities via `IncludeStyle.IncludeCategories`. Is that not sufficient?
> >
> >
> > It can be done by setting priorities in IncludeCategories, but here we have nearly 40+ cases and categories to hardcode due to complex interdependencies between their headers. So, I have added this style reducing the cases using regex. And if this is fully parameterised any OS related project can add their own header priorities.
>
>
> Note that `IncludeCategories` is already a regex - https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Sorry, my mistake I was but I added Regex for priorities while sorting and If I am not wrong I think IncludeCategories are used while Regrouping after sorting the Includes. In addition to that in my case I have to sort the includes In a particular order then grouping them in different
For example:
#include <sys/param.h> /* <sys/param.h> first, */
#include <sys/types.h> /* <sys/types.h> next, */
#include <sys/ioctl.h> /* and then the rest, */
#include <uvm/*.h>
#include <dev/*.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/route.h>
#include <netinet/in.h>
#include <protocols/rwhod.h>
As shown in the above example <uvm> should follow <sys> then <dev> but while regrouping they should be in the same group.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64695/new/
https://reviews.llvm.org/D64695
More information about the cfe-commits
mailing list