From 2cfda55ff059056fc2ae386369e93d24bc0e1cdd Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Fri, 25 Jun 2021 00:58:49 +0100 Subject: 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 --- .clang-format | 37 ++++++++++++++++++++++++++++++++++--- 1 file 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: '' + Priority: 1 + # Linux headers, as a second group/subset of system headers + - Regex: '' + Priority: 2 + # C++ library includes (no .h) + - Regex: '<([A-Za-z0-9\-_])+>' + Priority: 3 + # Headers for Base support + - Regex: '' + Priority: 4 + - Regex: '' + Priority: 5 + # Headers for libcamera, which are not in a subdir (i.e. ipa/,internal/) + - Regex: '' + Priority: 6 + # IPA Interfaces + - Regex: '' + 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 -- cgit v1.2.1