[PATCH] D64695: [clang-format] Added new style rule: SortNetBSDIncludes

Manikishan Ghantasala via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 10:04:18 PDT 2019


Manikishan added a comment.

In D64695#1589508 <https://reviews.llvm.org/D64695#1589508>, @lebedev.ri wrote:

> Is there sufficient test coverage as to what happens if `SortPriority` is not set?


If SortPriority is not set, the Includes will be grouped without sorting,

For example:

  #include <sys/param.h>
  #include <sys/types.h>
  #include <sys/ioctl.h>
  #include <net/if_dl.h>
  #include <net/route.h>
  #include <netinet/in.h>
  #include <sys/socket.h>
  #include <sys/stat.h>
  #include <sys/wait.h>
  #include <net/if.h>
  #include <protocols/rwhod.h>
  #include <assert.h>
  #include <paths.h>
  #include "pathnames.h"
  #include <errno.h>
  #include <inttypes.h>
  #include <stdio.h>
  #include <stdlib.h>

will be grouped as

  #include "pathnames.h"
  
  #include <assert.h>
  #include <errno.h>
  #include <inttypes.h>
  
  #include <net/if.h>
  #include <net/if_dl.h>
  #include <net/route.h>
  #include <netinet/in.h>
  
  #include <paths.h>
  
  #include <protocols/rwhod.h>
  
  #include <stdio.h>
  #include <stdlib.h>
  
  #include <sys/ioctl.h>
  #include <sys/param.h>
  #include <sys/socket.h>
  #include <sys/stat.h>
  #include <sys/types.h>
  #include <sys/wait.h>

Can we add a test case for this and mention that users should set SortPriority, or handle this case some how?
One way can be when the values are not set their Priority value is set as SortPriority, but this is also a problem 
when users give SortPriority as "0". Any comments on this issue?


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