Drew Macrae | f2396eb | 2022-06-30 14:28:08 -0400 | [diff] [blame] | 1 | # OpenTitan CI is using clang-format from the bazel workspace |
| 2 | # Documentation for this configuration is here: |
Philipp Wagner | cd9224e | 2020-11-11 21:01:14 +0000 | [diff] [blame] | 3 | # https://releases.llvm.org/6.0.0/tools/clang/docs/ClangFormatStyleOptions.html |
Sam Elliott | 7a98ea2 | 2020-05-11 14:59:07 +0100 | [diff] [blame] | 4 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 5 | BasedOnStyle: Google |
| 6 | AllowShortIfStatementsOnASingleLine: false |
| 7 | AllowShortLoopsOnASingleLine: false |
| 8 | DerivePointerAlignment: false |
| 9 | PointerAlignment: Right |
Sam Elliott | 7a98ea2 | 2020-05-11 14:59:07 +0100 | [diff] [blame] | 10 | |
| 11 | # Some of our headers in the sw/ tree are auto-generated, and it is useful to |
Sam Elliott | 3797697 | 2020-08-18 22:24:50 +0100 | [diff] [blame] | 12 | # keep those with each other, and separate from system headers and hand-written |
| 13 | # project headers. |
Sam Elliott | 7a98ea2 | 2020-05-11 14:59:07 +0100 | [diff] [blame] | 14 | # |
| 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. |
| 21 | IncludeCategories: |
Sam Elliott | 3797697 | 2020-08-18 22:24:50 +0100 | [diff] [blame] | 22 | - # System Headers: #include <*> |
| 23 | Regex: '^<.*>$' |
| 24 | Priority: 1 |
Sam Elliott | 7a98ea2 | 2020-05-11 14:59:07 +0100 | [diff] [blame] | 25 | - # Generated Register Headers: #include "*_regs.h" |
| 26 | Regex: '_regs\.h"$' |
Sam Elliott | 3797697 | 2020-08-18 22:24:50 +0100 | [diff] [blame] | 27 | Priority: 3 |
Sam Elliott | 7a98ea2 | 2020-05-11 14:59:07 +0100 | [diff] [blame] | 28 | - # Generated System Headers: #include "hw/**/autogen/*.h" |
| 29 | Regex: 'autogen' |
Sam Elliott | 3797697 | 2020-08-18 22:24:50 +0100 | [diff] [blame] | 30 | Priority: 3 |
Sam Elliott | 7a98ea2 | 2020-05-11 14:59:07 +0100 | [diff] [blame] | 31 | - # All Other Headers |
| 32 | Regex: '.*' |
Sam Elliott | 3797697 | 2020-08-18 22:24:50 +0100 | [diff] [blame] | 33 | Priority: 2 |