blob: b1a22cb3da7c108a5a0c30ff519d67e4542ed68c [file] [log] [blame]
# OpenTitan CI is using clang-format from the bazel workspace
# Documentation for this configuration is here:
# https://releases.llvm.org/6.0.0/tools/clang/docs/ClangFormatStyleOptions.html
BasedOnStyle: Google
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
DerivePointerAlignment: false
PointerAlignment: Right
# Some of our headers in the sw/ tree are auto-generated, and it is useful to
# keep those with each other, and separate from system headers and hand-written
# project headers.
#
# This is slightly more confusing as some headers are auto-generated at build
# time (*_regs.h), and some are auto-generated and checked in to the repo
# (hw/top_earlgrey/sw/autogen/*.h). These rules cover both occurences.
#
# The version of clang-format that we use does not regroup include statements,
# but this is something we could do in future.
IncludeCategories:
- # System Headers: #include <*>
Regex: '^<.*>$'
Priority: 1
- # Generated Register Headers: #include "*_regs.h"
Regex: '_regs\.h"$'
Priority: 3
- # Generated System Headers: #include "hw/**/autogen/*.h"
Regex: 'autogen'
Priority: 3
- # All Other Headers
Regex: '.*'
Priority: 2