blob: b1a22cb3da7c108a5a0c30ff519d67e4542ed68c [file] [log] [blame]
Drew Macraef2396eb2022-06-30 14:28:08 -04001# OpenTitan CI is using clang-format from the bazel workspace
2# Documentation for this configuration is here:
Philipp Wagnercd9224e2020-11-11 21:01:14 +00003# https://releases.llvm.org/6.0.0/tools/clang/docs/ClangFormatStyleOptions.html
Sam Elliott7a98ea22020-05-11 14:59:07 +01004
lowRISC Contributors802543a2019-08-31 12:12:56 +01005BasedOnStyle: Google
6AllowShortIfStatementsOnASingleLine: false
7AllowShortLoopsOnASingleLine: false
8DerivePointerAlignment: false
9PointerAlignment: Right
Sam Elliott7a98ea22020-05-11 14:59:07 +010010
11# Some of our headers in the sw/ tree are auto-generated, and it is useful to
Sam Elliott37976972020-08-18 22:24:50 +010012# keep those with each other, and separate from system headers and hand-written
13# project headers.
Sam Elliott7a98ea22020-05-11 14:59:07 +010014#
15# This is slightly more confusing as some headers are auto-generated at build
16# time (*_regs.h), and some are auto-generated and checked in to the repo
17# (hw/top_earlgrey/sw/autogen/*.h). These rules cover both occurences.
18#
19# The version of clang-format that we use does not regroup include statements,
20# but this is something we could do in future.
21IncludeCategories:
Sam Elliott37976972020-08-18 22:24:50 +010022- # System Headers: #include <*>
23 Regex: '^<.*>$'
24 Priority: 1
Sam Elliott7a98ea22020-05-11 14:59:07 +010025- # Generated Register Headers: #include "*_regs.h"
26 Regex: '_regs\.h"$'
Sam Elliott37976972020-08-18 22:24:50 +010027 Priority: 3
Sam Elliott7a98ea22020-05-11 14:59:07 +010028- # Generated System Headers: #include "hw/**/autogen/*.h"
29 Regex: 'autogen'
Sam Elliott37976972020-08-18 22:24:50 +010030 Priority: 3
Sam Elliott7a98ea22020-05-11 14:59:07 +010031- # All Other Headers
32 Regex: '.*'
Sam Elliott37976972020-08-18 22:24:50 +010033 Priority: 2