﻿---
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# We base things of WebKit + Allman braces
# Compatible with clang-format-22 (enforced by tools/run_clang_format.py)
Language: Cpp

# Access modifiers
AccessModifierOffset: -4
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
IndentAccessModifiers: false

# Alignment settings
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true

# Short constructs
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: false
LambdaBodyIndentation: Signature

# Template declarations
AlwaysBreakTemplateDeclarations: Yes

# Braces - Allman style
BreakBeforeBraces: Allman
BraceWrapping:
  AfterCaseLabel: true
  AfterClass: true
  AfterControlStatement: Always
  AfterEnum: true
  AfterFunction: true
  AfterNamespace: true
  AfterStruct: true
  AfterUnion: true
  BeforeCatch: true
  BeforeElse: true
  BeforeLambdaBody: true
  BeforeWhile: false
  IndentBraces: false
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true
  AfterExternBlock: true

# Constructor and inheritance
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeColon
ConstructorInitializerIndentWidth: 0
PackConstructorInitializers: BinPack

# Line limits and wrapping
ColumnLimit: 0 # Use your best judgement
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
BinPackArguments: false
BinPackParameters: false

# Namespaces
CompactNamespaces: false
NamespaceIndentation: None
WrapNamespaceBodyWithEmptyLines: Always
SeparateDefinitionBlocks: Always

# Braced lists and initializers
Cpp11BracedListStyle: false

# Indentation
IndentWidth: 4
IndentCaseLabels: true
IndentPPDirectives: None
IndentWrappedFunctionNames: false
ContinuationIndentWidth: 4

# Empty lines
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1

# Pointer and reference alignment
PointerAlignment: Left
ReferenceAlignment: Pointer
QualifierAlignment: Left # West Const

# Comments
ReflowComments: Always
SpacesBeforeTrailingComments: 1

# Include sorting
SortIncludes: true
SortUsingDeclarations: LexicographicNumeric

# Spacing
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
  AfterControlStatements: true
  AfterForeachMacros: true
  AfterFunctionDefinitionName: false
  AfterFunctionDeclarationName: false
  AfterIfMacros: true
  BeforeNonEmptyParentheses: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInParens: Never
SpacesInSquareBrackets: false

# C++ standard
Standard: Latest

# Tabs
UseTab: Never
TabWidth: 4

# Binary operators
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true

# String handling
BreakStringLiterals: true

# Other formatting options
FixNamespaceComments: true

...
