# OpenTitan CI is using clang-format 6.0. The 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
