Skip to content

Commit f2240be

Browse files
authored
Merge pull request #6620 from tautschnig/cleanup/clang-format-includes
Codify grouping and order of includes
2 parents 9364e45 + 3b7b19a commit f2240be

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.clang-format

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,18 @@ NamespaceIndentation: None
4747
PenaltyBreakString: 10000
4848
PointerAlignment: Right
4949
ReflowComments: 'false'
50-
SortIncludes: 'true'
50+
IncludeBlocks: Regroup
51+
IncludeCategories:
52+
- Regex: '<util/'
53+
Priority: 1
54+
- Regex: '<goto-programs/'
55+
Priority: 2
56+
- Regex: '<.+/.+>'
57+
Priority: 3
58+
- Regex: '^"[^/]+"$'
59+
Priority: 4
60+
- Regex: '<[^/]+>'
61+
Priority: 5
5162
SpaceAfterCStyleCast: 'false'
5263
SpaceBeforeAssignmentOperators: 'true'
5364
SpaceBeforeParens: Never

CODING_STANDARD.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Formatting is enforced using clang-format. For more information about this, see
148148
- The corresponding header for a given source file should always be the *first*
149149
include in the source file. For example, given `foo.h` and `foo.cpp`, the
150150
line `#include "foo.h"` should precede all other include statements in
151-
`foo.cpp`.
151+
`foo.cpp`. clang-format will enforce this.
152152
- Use the C++ versions of C headers (e.g. `cmath` instead of `math.h`).
153153
Some of the C headers use macros instead of functions which can have
154154
unexpected consequences.

0 commit comments

Comments
 (0)