---
# MNN C++ Code Style
# Based on Google style with project-specific overrides
# Usage: clang-format -i -style=file <file>

BasedOnStyle: Google
Language: Cpp

# Indentation
IndentWidth: 4
ContinuationIndentWidth: 4
AccessModifierOffset: -4
ConstructorInitializerIndentWidth: 4

# Line width
ColumnLimit: 120

# Braces
BreakBeforeBraces: Attach
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortBlocksOnASingleLine: false

# Includes
SortIncludes: Never
IncludeBlocks: Preserve

# Alignment
# Note: The codebase has some manual consecutive-assignment alignment, but enabling
# AlignConsecutiveAssignments globally causes more harm than good (misaligns isolated lines).
# Leave it off; manually aligned blocks are preserved as-is when untouched.
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignTrailingComments: true

# Pointers & References
DerivePointerAlignment: false
PointerAlignment: Left

# Misc
SpaceAfterCStyleCast: false
SpaceBeforeParens: ControlStatements
SpacesBeforeTrailingComments: 1
Standard: c++11
TabWidth: 4
UseTab: Never
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
FixNamespaceComments: true
ReflowComments: true

# Penalty tuning (prefer not breaking certain constructs)
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
---
