summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-06-25 00:58:49 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-08-05 08:53:59 +0100
commit2cfda55ff059056fc2ae386369e93d24bc0e1cdd (patch)
tree4e28204a388716e86055d19425d001a08b128412
parent25e0c2b7aaba203e34e92e9d2a89e73bfb0b67c3 (diff)
clang-format: Regroup sort orders
Utilise the clang-format header sort to provide a regex based pattern match for our header inclusion coding style. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--.clang-format37
1 files changed, 34 insertions, 3 deletions
diff --git a/.clang-format b/.clang-format
index 3a8a896e..5ecba901 100644
--- a/.clang-format
+++ b/.clang-format
@@ -66,10 +66,41 @@ ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- 'udev_list_entry_foreach'
-IncludeBlocks: Preserve
+SortIncludes: true
+IncludeBlocks: Regroup
IncludeCategories:
- - Regex: '.*'
- Priority: 1
+ # Headers in <> with or without extension. (system libraries)
+ - Regex: '<([A-Za-z0-9\-_])+.h>'
+ Priority: 1
+ - Regex: '<sys/.*>'
+ Priority: 1
+ # Linux headers, as a second group/subset of system headers
+ - Regex: '<linux/.*>'
+ Priority: 2
+ # C++ library includes (no .h)
+ - Regex: '<([A-Za-z0-9\-_])+>'
+ Priority: 3
+ # Headers for Base support
+ - Regex: '<libcamera/base/private.h>'
+ Priority: 4
+ - Regex: '<libcamera/base/([A-Za-z0-9])+.*>'
+ Priority: 5
+ # Headers for libcamera, which are not in a subdir (i.e. ipa/,internal/)
+ - Regex: '<libcamera/([A-Za-z0-9\-_])+.h>'
+ Priority: 6
+ # IPA Interfaces
+ - Regex: '<libcamera/ipa/([A-Za-z0-9])+.*>'
+ Priority: 7
+ # libcamera Internal headers in ""
+ - Regex: '"libcamera/internal/.*\.h"'
+ Priority: 8
+ # local modular includes
+ - Regex: '".*/.*\.h"'
+ Priority: 9
+ # Other local headers "" with extension.
+ - Regex: '"([A-Za-z0-9.\/-_])+"'
+ Priority: 10
+
IncludeIsMainRegex: '(_test)?$'
IndentCaseLabels: false
IndentPPDirectives: None