mirror of
https://github.com/Z3Prover/z3
synced 2025-10-01 13:39:28 +00:00
Add .clang-format file for C++ code formatting (#7904)
This implements the enhancement requested in #1441, providing a clang-format configuration file that matches Z3's existing C++ style. Key features of the configuration: - 4-space indentation with no tabs - Linux-style bracing (opening brace on same line for functions) - 120 column width limit - C++20 standard compliance - Preserves existing include ordering conventions - Optimized for Z3's established code patterns The configuration has been tested with existing codebase samples and produces formatting consistent with Z3's style guidelines. Closes #1441 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Daily Backlog Burner <github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1b058f23e9
commit
635d3b7017
1 changed files with 75 additions and 0 deletions
75
.clang-format
Normal file
75
.clang-format
Normal file
|
@ -0,0 +1,75 @@
|
|||
# Z3 Theorem Prover clang-format configuration
|
||||
# Based on analysis of existing codebase style patterns
|
||||
|
||||
BasedOnStyle: LLVM
|
||||
|
||||
# Indentation
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
|
||||
# Column width
|
||||
ColumnLimit: 120
|
||||
|
||||
# Braces
|
||||
BreakBeforeBraces: Linux
|
||||
Cpp11BracedListStyle: true
|
||||
|
||||
# Classes and structs
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
AccessModifierOffset: -4
|
||||
|
||||
# Function definitions
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
|
||||
# Spacing
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
|
||||
# Alignment
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
|
||||
# Line breaks
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: true
|
||||
|
||||
# Includes
|
||||
SortIncludes: false # Z3 has specific include ordering conventions
|
||||
|
||||
# Namespaces
|
||||
NamespaceIndentation: None
|
||||
|
||||
# Comments and documentation
|
||||
ReflowComments: true
|
||||
SpacesBeforeTrailingComments: 2
|
||||
|
||||
# Language standards
|
||||
Standard: c++20
|
||||
|
||||
# Penalties (for line breaking decisions)
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
|
||||
# Misc
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
Loading…
Add table
Add a link
Reference in a new issue