summaryrefslogtreecommitdiff
path: root/.clang-format
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2019-09-21 16:38:38 +0200
committerBrad King <brad.king@kitware.com>2019-10-01 12:25:48 -0400
commit185fe49f29f6632a3c26c376fcb4934e91092ff7 (patch)
treea1ced004e5fbad2c766e21fe1fec0a5845538162 /.clang-format
parent42ef28b4f3b2f1af5508319b69352647d7e00985 (diff)
downloadcmake-185fe49f29f6632a3c26c376fcb4934e91092ff7.tar.gz
clang-format: Normalize headers presentation
By using clang-format directives 'IncludeBlocks' and 'IncludeCategories' headers are regrouped by categories: 1. "cmConfigure.h" which must be first 2. header matching current implementation file 3. standard language headers 4. CMake replacement ones 5. external headers (i.e. #include directive with '<' and '>') 6. Qt headers 7. cmsys/* headers 8. cm_* headers 9. CMake headers (i.e. starting with 'cm[A-Z]') 10. all other headers Fixes: #19674
Diffstat (limited to '.clang-format')
-rw-r--r--.clang-format24
1 files changed, 24 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
index 162c56d763..0c7d6b0720 100644
--- a/.clang-format
+++ b/.clang-format
@@ -18,4 +18,28 @@ ColumnLimit: 79
IndentPPDirectives: AfterHash
SortUsingDeclarations: false
SpaceAfterTemplateKeyword: true
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^[<"]cmConfigure\.h'
+ Priority: -1
+ - Regex: '^(<|")cm/'
+ Priority: 2
+ - Regex: '^(<|")windows\.h'
+ Priority: 3
+ - Regex: '^<sys/'
+ Priority: 5
+ - Regex: '^(<|")Qt?[A-Z]'
+ Priority: 6
+ - Regex: '^(<|")cmsys/'
+ Priority: 7
+ - Regex: '^(<|")cm_'
+ Priority: 8
+ - Regex: '^(<|")cm[A-Z][^.]+\.h'
+ Priority: 9
+ - Regex: '^<[^.]+\.h'
+ Priority: 4
+ - Regex: '^<'
+ Priority: 1
+ - Regex: '.*'
+ Priority: 10
...