Created
August 19, 2025 22:05
-
-
Save bulkasizumom/830a7856375bb4d7485b6be571919b3e to your computer and use it in GitHub Desktop.
C++ clang-format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # === BASE CONFIGURATION === | |
| BasedOnStyle: LLVM | |
| ColumnLimit: 120 | |
| IndentWidth: 4 | |
| UseTab: Never | |
| # === INDENTATION AND STRUCTURE === | |
| AccessModifierOffset: -4 | |
| IndentCaseLabels: true | |
| IndentCaseBlocks: true | |
| BracedInitializerIndentWidth: 4 | |
| LambdaBodyIndentation: OuterScope | |
| AlignConsecutiveShortCaseStatements: | |
| Enabled: true | |
| AcrossEmptyLines: false | |
| AcrossComments: false | |
| AlignCaseColons: false | |
| IndentRequiresClause: false | |
| NamespaceIndentation: All | |
| PPIndentWidth: 4 | |
| IndentPPDirectives: AfterHash | |
| RequiresExpressionIndentation: OuterScope | |
| # === ALIGNMENT FOR READABILITY === | |
| AlignAfterOpenBracket: Align | |
| AlignConsecutiveAssignments: Consecutive | |
| AlignConsecutiveDeclarations: None | |
| AlignConsecutiveMacros: Consecutive | |
| AlignOperands: AlignAfterOperator | |
| AlignTrailingComments: | |
| Kind: Always | |
| OverEmptyLines: 1 | |
| AlignArrayOfStructures: Right | |
| AlignEscapedNewlines: Right | |
| # === LINE BREAKING BEHAVIOR === | |
| AllowShortBlocksOnASingleLine: Empty | |
| AllowShortFunctionsOnASingleLine: Inline | |
| AllowShortCaseExpressionOnASingleLine: true | |
| AllowShortCaseLabelsOnASingleLine: true | |
| AllowShortIfStatementsOnASingleLine: AllIfsAndElse | |
| AllowShortLambdasOnASingleLine: All | |
| AllowShortLoopsOnASingleLine: true | |
| ShortNamespaceLines: 1 | |
| BreakAfterReturnType: None | |
| AlwaysBreakBeforeMultilineStrings: false | |
| BreakTemplateDeclarations: Yes | |
| BreakBeforeBinaryOperators: None | |
| BreakBeforeBraces: Attach | |
| BreakBeforeConceptDeclarations: Always | |
| BreakConstructorInitializers: BeforeColon | |
| BreakStringLiterals: true | |
| # === SPACING CONFIGURATION === | |
| SpaceAfterCStyleCast: false | |
| SpaceAfterLogicalNot: false | |
| SpaceAfterTemplateKeyword: true | |
| SpaceBeforeAssignmentOperators: true | |
| SpaceBeforeCpp11BracedList: false | |
| SpaceBeforeParens: ControlStatements | |
| SpaceBeforeSquareBrackets: false | |
| SpaceInEmptyBlock: false | |
| SpacesInAngles: Never | |
| SpacesInContainerLiterals: false | |
| SpacesInLineCommentPrefix: | |
| Minimum: 1 | |
| Maximum: 1 | |
| SpacesInParens: Never | |
| SpacesInSquareBrackets: false | |
| # === AUTOMATIC CODE IMPROVEMENTS === | |
| InsertBraces: true | |
| RemoveBracesLLVM: true | |
| RemoveParentheses: ReturnStatement | |
| FixNamespaceComments: true | |
| SortUsingDeclarations: true | |
| CompactNamespaces: false | |
| # === C++ STYLE === | |
| PointerAlignment: Left | |
| ReferenceAlignment: Pointer | |
| QualifierAlignment: Left | |
| Cpp11BracedListStyle: true | |
| RequiresClausePosition: OwnLine | |
| BitFieldColonSpacing: Both | |
| IntegerLiteralSeparator: | |
| Binary: 4 | |
| BinaryMinDigits: 8 | |
| Hex: 4 | |
| HexMinDigits: 8 | |
| Decimal: 3 | |
| DecimalMinDigits: 7 | |
| # === CLASS AND FUNCTION STRUCTURE === | |
| SeparateDefinitionBlocks: Always | |
| EmptyLineAfterAccessModifier: Never | |
| EmptyLineBeforeAccessModifier: LogicalBlock | |
| PackConstructorInitializers: CurrentLine | |
| # === COMMENTS AND EMPTY LINES === | |
| ReflowComments: true | |
| KeepEmptyLines: | |
| AtEndOfFile: false | |
| AtStartOfBlock: false | |
| AtStartOfFile: false | |
| KeepEmptyLinesAtTheStartOfBlocks: false | |
| # === INCLUDE ORGANIZATION === | |
| IncludeBlocks: Regroup | |
| IncludeCategories: | |
| # Related headers (same directory) | |
| - Regex: '^"[^/]*\.(h|hpp)\"$' | |
| Priority: 1 | |
| SortPriority: 1 | |
| # Project headers (subdirectories) | |
| - Regex: '^".*"$' | |
| Priority: 2 | |
| SortPriority: 2 | |
| # C system headers - platform layer | |
| - Regex: '^<.*\.h>$' | |
| Priority: 3 | |
| SortPriority: 3 | |
| # C++ standard library - language layer | |
| - Regex: '^<[a-z][a-z0-9_]*>$' | |
| Priority: 4 | |
| SortPriority: 4 | |
| # External libraries - third-party dependencies | |
| - Regex: '^<[A-Z].*>$|^<.*[A-Z/].*>$' | |
| Priority: 5 | |
| SortPriority: 5 | |
| # Fallback for edge cases | |
| - Regex: '^<.*>$' | |
| Priority: 6 | |
| SortPriority: 6 | |
| SortIncludes: CaseSensitive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment