Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 41 additions & 7 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
# vim: ft=yaml
Language: Cpp
BasedOnStyle: Microsoft

AccessModifierOffset: -4

AlignAfterOpenBracket: BlockIndent
AlignAfterOpenBracket: true
AlignArrayOfStructures: Left
AlignConsecutiveAssignments:
Enabled: true
Expand All @@ -20,7 +21,7 @@ AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
#AlignFunctionDeclarations: false # only for AlignConsecutiveDeclarations # clang-format 20
AlignFunctionDeclarations: true # only for AlignConsecutiveDeclarations # clang-format 20
AlignFunctionPointers: false # only for AlignConsecutiveDeclarations
AlignConsecutiveMacros:
Enabled: true
Expand All @@ -43,6 +44,7 @@ AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true

AllowBreakBeforeNoexceptSpecifier: Never
AllowBreakBeforeQtProperty: false # clang-format 22

AllowShortBlocksOnASingleLine: Empty
AllowShortCaseExpressionOnASingleLine: true
Expand All @@ -53,6 +55,7 @@ AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AllowShortNamespacesOnASingleLine: false # clang-format 20

AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
Expand All @@ -64,8 +67,9 @@ AttributeMacros:
- __ununsed
- GSL_SUPPRESS

BinPackArguments: false
BinPackParameters: false
BinPackArguments: false
BinPackLongBracedList: true # clang-format 21
BinPackParameters: OnePerLine

BitFieldColonSpacing: Both
BraceWrapping:
Expand All @@ -90,12 +94,24 @@ BraceWrapping:
BracedInitializerIndentWidth: 4
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterReturnType: ExceptShortType
BreakAfterOpenBracketBracedList: true # clang-format 22
BreakAfterOpenBracketFunction: true # clang-format 22
BreakAfterOpenBracketIf: true # clang-format 22
BreakAfterOpenBracketLoop: true # clang-format 22
BreakAfterOpenBracketSwitch: true # clang-format 22
BreakAfterReturnType: Automatic
BreakBeforeBinaryOperators: None # TBD
BreakBeforeBraces: Custom
BreakBeforeCloseBracketBracedList: true # clang-format 22
BreakBeforeCloseBracketFunction: true # clang-format 22
BreakBeforeCloseBracketIf: true # clang-format 22
BreakBeforeCloseBracketLoop: true # clang-format 22
BreakBeforeCloseBracketSwitch: true # clang-format 22
BreakBeforeConceptDeclarations: Always
BreakBeforeInlineASMColon: Always
BreakBeforeTemplateCloser: true # clang-format 21
BreakBeforeTernaryOperators: false
BreakBinaryOperations: RespectPrecedence # clang-format 20
BreakConstructorInitializers: BeforeComma
BreakFunctionDefinitionParameters: false
BreakInheritanceList: BeforeComma
Expand All @@ -108,14 +124,15 @@ CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
Cpp11BracedListStyle: FunctionCall # clang-format 22

DeriveLineEnding: true
DerivePointerAlignment: true

DisableFormat: false
EmptyLineAfterAccessModifier: Leave
EmptyLineBeforeAccessModifier: Leave
EnumTrailingComma: Leave # clang-format 21, not safe if not set to Leave
FixNamespaceComments: true
ForEachMacros:
- foreach
Expand All @@ -139,6 +156,7 @@ IncludeIsMainSourceRegex: ""
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExportBlock: false # clang-format 20
IndentExternBlock: NoIndent
IndentGotoLabels: false
IndentPPDirectives: BeforeHash
Expand All @@ -159,22 +177,33 @@ KeepEmptyLines:
AtEndOfFile: true
AtStartOfBlock: false
AtStartOfFile: false
KeepFormFeed: true # clang-format 20

LambdaBodyIndentation: Signature
MacroBlockBegin: "" # TBD
MacroBlockEnd: "" # TBD
Macros: [] # TBD
#MainIncludeChar: Quota # clang-format 20
# A vector of function-like macros whose invocations should be skipped by RemoveParentheses.
MacrosSkippedByRemoveParentheses: [] # TBD, clang-format 21
MainIncludeChar: Quote # clang-format 19
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
NamespaceMacros: [] # TBD A vector of macros which are used to open namespace blocks.
NumericLiteralCase: # clang-format 22
ExponentLetter: Leave
HexDigit: Leave
Prefix: Leave
Suffix: Leave

OneLineFormatOffRegex: '' # clone-format 21

PPIndentWidth: -1 # default to IndentWidth
PackConstructorInitializers: Never

# Penalty is hard to understand, leave it to default(style=Microsoft)
#PenaltyBreakAssignment: 2
#PenaltyBreakBeforeFirstCallParameter: 19
#PenaltyBreakBeforeMemberAccess: 150 # clang-format 20
#PenaltyBreakComment: 300
#PenaltyBreakFirstLessLess: 120
#PenaltyBreakOpenParenthesis: 0
Expand All @@ -195,6 +224,8 @@ ReferenceAlignment: Left

ReflowComments: false

RemoveEmptyLinesInUnwrappedLines: true # clang-format 20
RemoveParentheses: Leave # not safe if not Leave
RemoveSemicolon: false # not safe if true

RequiresClausePosition: OwnLine
Expand All @@ -209,6 +240,7 @@ SortUsingDeclarations: false

SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterOperatorKeyword: false # clang-format 21
SpaceAfterTemplateKeyword: false

SpaceAroundPointerQualifiers: Default
Expand Down Expand Up @@ -268,6 +300,8 @@ WhitespaceSensitiveMacros:
- PP_STRINGIZE
- BOOST_PP_STRINGIZE

WrapNamespaceBodyWithEmptyLines: Always # clang-format 20

---
Language: Json
BreakArrays: false
Expand Down
Loading
Loading