Language: Cpp
BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 4
NamespaceIndentation: None
ColumnLimit: 120
# Docstrings are hand-formatted to a fixed 6-space continuation indent; do not let clang-format reflow
# comment bodies (ReflowComments:true would collapse that to a 1-space hanging indent).
ReflowComments: false
UseTab: Never
IndentPPDirectives: None
InsertNewlineAtEOF: true
PointerAlignment: Right
DerivePointerAlignment: false
BreakBeforeBinaryOperators: None
PenaltyBreakAssignment: 50

# StringZilla-specific macros
# Visibility/linkage macros that act like storage class specifiers
StatementAttributeLikeMacros:
  - SZ_API_COMPTIME
  - SZ_API_RUNTIME
  - SZ_HELPER_AUTO
  - SZ_HELPER_INLINE
  - SZ_HELPER_NOINLINE

# Attribute-like macros (clang-format 12+)
AttributeMacros:
  - SZ_NO_STACK_PROTECTOR
  - sz_align_

# Macros that behave like type qualifiers in parameters
TypenameMacros:
  - sz_at_least_

AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: true
AlignOperands: true
AlignTrailingComments: true

AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Always
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakTemplateDeclarations: Yes
AlwaysBreakAfterReturnType: None
PenaltyReturnTypeOnItsOwnLine: 200

BreakBeforeBraces: Custom
BraceWrapping:
  AfterCaseLabel: false
  AfterClass: false
  AfterControlStatement: false
  AfterEnum: false
  AfterExternBlock: false
  AfterFunction: false
  AfterStruct: false
  AfterNamespace: false
  AfterUnion: false
  BeforeCatch: true
  BeforeElse: true
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  SplitEmptyNamespace: false
  IndentBraces: false

SortIncludes: false
SortUsingDeclarations: false

SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false

BinPackArguments: true
BinPackParameters: true
PenaltyBreakBeforeFirstCallParameter: 1

# Pack long braced lists (big LUT / constant tables) densely instead of one element per line.
# Requires clang-format 22+ (we use clang-format-23).
BreakAdjacentStringLiterals: false
BinPackLongBracedList: true
BreakBeforeCloseBracketBracedList: false
