mirror of
https://github.com/Z3Prover/z3
synced 2025-10-08 08:51:55 +00:00
Daily Backlog Burner: Add .clang-format file for consistent code formatting
This addresses issue #1441 by providing a comprehensive clang-format configuration that standardizes C++ code formatting across the Z3 codebase. The configuration is based on analysis of existing code style patterns: - 4-space indentation (no tabs) - Attached braces (same line as declarations) - Left-aligned pointers and references (Type* ptr, Type& ref) - No column limit (allows long lines as commonly seen in codebase) - Allows short functions/blocks on single lines - Consistent spacing around operators and keywords Features: - Enables 'git clang-format' for formatting patches - Supports editor integration with clang-format plugins - Provides consistent style for new contributions - Based on Google style with Z3-specific customizations Usage: - Format entire file: clang-format -i filename.cpp - Format git changes: git clang-format - Editor integration available for vim, emacs, VS Code, etc. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
81da4be228
commit
33de44cdc8
1 changed files with 92 additions and 0 deletions
92
.clang-format
Normal file
92
.clang-format
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
# Z3 Theorem Prover - clang-format configuration
|
||||||
|
# This configuration file standardizes code formatting across the Z3 codebase
|
||||||
|
# Based on analysis of existing code style patterns in the repository
|
||||||
|
|
||||||
|
# Use Google style as base and customize
|
||||||
|
BasedOnStyle: Google
|
||||||
|
|
||||||
|
# Basic formatting
|
||||||
|
IndentWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
ColumnLimit: 0
|
||||||
|
|
||||||
|
# Brace placement - Z3 uses attached braces consistently
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
|
||||||
|
# Function and control structure formatting
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: true
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: Always
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
|
||||||
|
# Spacing
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
|
||||||
|
# Pointer and reference alignment - Z3 uses "Type * ptr" style
|
||||||
|
PointerAlignment: Left
|
||||||
|
|
||||||
|
# Namespace formatting - Z3 typically doesn't indent namespace contents
|
||||||
|
NamespaceIndentation: None
|
||||||
|
|
||||||
|
# Template formatting
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
|
||||||
|
# Constructor initializers
|
||||||
|
BreakConstructorInitializers: BeforeColon
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
|
||||||
|
# Function parameters and arguments
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
BinPackParameters: true
|
||||||
|
BinPackArguments: true
|
||||||
|
|
||||||
|
# Include formatting
|
||||||
|
SortIncludes: true
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
|
||||||
|
# Other settings
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: MultiLine
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeInheritanceComma: false
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakStringLiterals: true
|
||||||
|
CompactNamespaces: false
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: false
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
ReflowComments: true
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
# SpaceInEmptyBlockComment: true # Not supported in this version
|
||||||
|
Standard: Cpp11
|
||||||
|
TabWidth: 4
|
||||||
|
|
||||||
|
# Language-specific settings
|
||||||
|
Language: Cpp
|
||||||
|
|
||||||
|
# Disable formatting for specific areas if needed
|
||||||
|
# Use // clang-format off and // clang-format on to disable/enable formatting
|
Loading…
Add table
Add a link
Reference in a new issue