# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# https://releases.llvm.org/19.1.0/tools/clang/docs/ClangFormatStyleOptions.html

# To update this .clang-format file for a new clang-format version:
# 1. Update the documentation link above.
# 2. Copy the output of `clang-format -dump-config --style=LLVM` into a temporary file.
#    a. Comment out all of its lines.
# 3. Compare that temporary file to this .clang-format file.
# 4. Adjust this .clang-format file to record new and updated options.
#    a. Read the new documentation to understand such changes.
# 5. The goal is for the comparison from the temporary file to this .clang-format file to be pure additions (green).
#    a. That is, comments here are recording the defaults, while added lines are our customized settings.

---
# Language:        Cpp
BasedOnStyle:  LLVM
# AccessModifierOffset: -2
AccessModifierOffset: -4
# AlignAfterOpenBracket: Align
AlignAfterOpenBracket: DontAlign
# AlignArrayOfStructures: None
# AlignConsecutiveAssignments:
#   Enabled:         false
#   AcrossEmptyLines: false
#   AcrossComments:  false
#   AlignCompound:   false
#   AlignFunctionPointers: false
#   PadOperators:    true
AlignConsecutiveAssignments: Consecutive
# AlignConsecutiveBitFields:
#   Enabled:         false
#   AcrossEmptyLines: false
#   AcrossComments:  false
#   AlignCompound:   false
#   AlignFunctionPointers: false
#   PadOperators:    false
# AlignConsecutiveDeclarations:
#   Enabled:         false
#   AcrossEmptyLines: false
#   AcrossComments:  false
#   AlignCompound:   false
#   AlignFunctionPointers: false
#   PadOperators:    false
# AlignConsecutiveMacros:
#   Enabled:         false
#   AcrossEmptyLines: false
#   AcrossComments:  false
#   AlignCompound:   false
#   AlignFunctionPointers: false
#   PadOperators:    false
AlignConsecutiveMacros: Consecutive
# AlignConsecutiveShortCaseStatements:
#   Enabled:         false
#   AcrossEmptyLines: false
#   AcrossComments:  false
#   AlignCaseArrows: false
#   AlignCaseColons: false
# AlignConsecutiveTableGenBreakingDAGArgColons:
#   Enabled:         false
#   AcrossEmptyLines: false
#   AcrossComments:  false
#   AlignCompound:   false
#   AlignFunctionPointers: false
#   PadOperators:    false
# AlignConsecutiveTableGenCondOperatorColons:
#   Enabled:         false
#   AcrossEmptyLines: false
#   AcrossComments:  false
#   AlignCompound:   false
#   AlignFunctionPointers: false
#   PadOperators:    false
# AlignConsecutiveTableGenDefinitionColons:
#   Enabled:         false
#   AcrossEmptyLines: false
#   AcrossComments:  false
#   AlignCompound:   false
#   AlignFunctionPointers: false
#   PadOperators:    false
# AlignEscapedNewlines: Right
AlignEscapedNewlines: Left
# AlignOperands:   Align
AlignOperands: AlignAfterOperator
# AlignTrailingComments:
#   Kind:            Always
#   OverEmptyLines:  0
AlignTrailingComments:
  Kind:            Never
# AllowAllArgumentsOnNextLine: true
# AllowAllParametersOfDeclarationOnNextLine: true
# AllowBreakBeforeNoexceptSpecifier: Never
AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
# AllowShortBlocksOnASingleLine: Never
# AllowShortCaseExpressionOnASingleLine: true
# AllowShortCaseLabelsOnASingleLine: false
# AllowShortCompoundRequirementOnASingleLine: true
# AllowShortEnumsOnASingleLine: true
# AllowShortFunctionsOnASingleLine: All
AllowShortFunctionsOnASingleLine: Empty
# AllowShortIfStatementsOnASingleLine: Never
# AllowShortLambdasOnASingleLine: All
# AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakBeforeMultilineStrings: false
# AttributeMacros:
#   - __capability
# BinPackArguments: true
# BinPackParameters: true
# BitFieldColonSpacing: Both
# BraceWrapping:
#   AfterCaseLabel:  false
#   AfterClass:      false
#   AfterControlStatement: Never
#   AfterEnum:       false
#   AfterExternBlock: false
#   AfterFunction:   false
#   AfterNamespace:  false
#   AfterObjCDeclaration: false
#   AfterStruct:     false
#   AfterUnion:      false
#   BeforeCatch:     false
#   BeforeElse:      false
#   BeforeLambdaBody: false
#   BeforeWhile:     false
#   IndentBraces:    false
#   SplitEmptyFunction: true
#   SplitEmptyRecord: true
#   SplitEmptyNamespace: true
# BreakAdjacentStringLiterals: true
# BreakAfterAttributes: Leave
BreakAfterAttributes: Never
# BreakAfterJavaFieldAnnotations: false
# BreakAfterReturnType: None
# BreakArrays:     true
# BreakBeforeBinaryOperators: None
BreakBeforeBinaryOperators: NonAssignment
# BreakBeforeConceptDeclarations: Always
# BreakBeforeBraces: Attach
# BreakBeforeInlineASMColon: OnlyMultiline
# BreakBeforeTernaryOperators: true
# BreakConstructorInitializers: BeforeColon
# BreakFunctionDefinitionParameters: false
# BreakInheritanceList: BeforeColon
# BreakStringLiterals: true
# BreakTemplateDeclarations: MultiLine
BreakTemplateDeclarations: Yes
# ColumnLimit:     80
ColumnLimit:     120
# CommentPragmas:  '^ IWYU pragma:'
# CompactNamespaces: false
# ConstructorInitializerIndentWidth: 4
# ContinuationIndentWidth: 4
# Cpp11BracedListStyle: true
# DerivePointerAlignment: false
# DisableFormat:   false
# EmptyLineAfterAccessModifier: Never
# EmptyLineBeforeAccessModifier: LogicalBlock
# ExperimentalAutoDetectBinPacking: false
# FixNamespaceComments: true
# ForEachMacros:
#   - foreach
#   - Q_FOREACH
#   - BOOST_FOREACH
# IfMacros:
#   - KJ_IF_MAYBE
# IncludeBlocks:   Preserve
IncludeBlocks:   Regroup
# IncludeCategories:
#   - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
#     Priority:        2
#     SortPriority:    0
#     CaseSensitive:   false
#   - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
#     Priority:        3
#     SortPriority:    0
#     CaseSensitive:   false
#   - Regex:           '.*'
#     Priority:        1
#     SortPriority:    0
#     CaseSensitive:   false
IncludeCategories:
  - Regex:           '^<(yvals|yvals_core)\.h>$'
    Priority:        10
  - Regex:           '^<__msvc_.*\.hpp>$'
    Priority:        20
  - Regex:           '^<initguid\.h>$' # <initguid.h> should be included before any header that includes <guiddef.h>
    Priority:        30
    SortPriority:    30
  - Regex:           '^<(DbgEng|DbgHelp|Shlwapi|Windows)\.h>$'
    Priority:        30
    SortPriority:    31
  - Regex:           '^<winioctl\.h>$'
    Priority:        30
    SortPriority:    32
  - Regex:           '\.hpp[>"]$'
    Priority:        40
  - Regex:           '.*'
    Priority:        20
# IncludeIsMainRegex: '(Test)?$'
# IncludeIsMainSourceRegex: ''
# IndentAccessModifiers: false
# IndentCaseBlocks: false
IndentCaseBlocks: true
# IndentCaseLabels: false
# IndentExternBlock: AfterExternBlock
# IndentGotoLabels: true
# IndentPPDirectives: None
# IndentRequiresClause: true
# IndentWidth:     2
IndentWidth:     4
# IndentWrappedFunctionNames: false
IndentWrappedFunctionNames: true
# InsertBraces:    false
InsertBraces:    true
# InsertNewlineAtEOF: false
InsertNewlineAtEOF: true
# InsertTrailingCommas: None
# IntegerLiteralSeparator:
#   Binary:          0
#   BinaryMinDigits: 0
#   Decimal:         0
#   DecimalMinDigits: 0
#   Hex:             0
#   HexMinDigits:    0
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
# KeepEmptyLines:
#   AtEndOfFile:     false
#   AtStartOfBlock:  true
#   AtStartOfFile:   true
KeepEmptyLines:
  AtStartOfFile:   false
# LambdaBodyIndentation: Signature
# LineEnding:      DeriveLF
LineEnding:      CRLF
# NOTE: MacroBlockBegin/MacroBlockEnd don't work with _CATCH_ALL.
# MacroBlockBegin: ''
# MacroBlockEnd:   ''
# MainIncludeChar: Quote
# MaxEmptyLinesToKeep: 1
MaxEmptyLinesToKeep: 2
# NamespaceIndentation: None
NamespaceIndentation: All
# ObjCBinPackProtocolList: Auto
# ObjCBlockIndentWidth: 2
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
# PackConstructorInitializers: BinPack
# PenaltyBreakAssignment: 2
# PenaltyBreakBeforeFirstCallParameter: 19
# PenaltyBreakComment: 300
# PenaltyBreakFirstLessLess: 120
# PenaltyBreakOpenParenthesis: 0
# PenaltyBreakScopeResolution: 500
# PenaltyBreakString: 1000
# PenaltyBreakTemplateDeclaration: 10
# PenaltyExcessCharacter: 1000000
# PenaltyIndentedWhitespace: 0
# PenaltyReturnTypeOnItsOwnLine: 60
# PointerAlignment: Right
PointerAlignment: Left
# PPIndentWidth:   -1
# QualifierAlignment: Leave
# ReferenceAlignment: Pointer
# ReflowComments:  true
# RemoveBracesLLVM: false
# RemoveParentheses: Leave
# RemoveSemicolon: false
RemoveSemicolon: true
# RequiresClausePosition: OwnLine
# RequiresExpressionIndentation: OuterScope
# SeparateDefinitionBlocks: Leave
# ShortNamespaceLines: 1
# SkipMacroDefinitionBody: false
# SortIncludes:    CaseSensitive
# SortJavaStaticImport: Before
# SortUsingDeclarations: LexicographicNumeric
# SpaceAfterCStyleCast: false
SpaceAfterCStyleCast: true
# SpaceAfterLogicalNot: false
# SpaceAfterTemplateKeyword: true
# SpaceAroundPointerQualifiers: Default
# SpaceBeforeAssignmentOperators: true
# SpaceBeforeCaseColon: false
# SpaceBeforeCpp11BracedList: false
# SpaceBeforeCtorInitializerColon: true
# SpaceBeforeInheritanceColon: true
# SpaceBeforeJsonColon: false
# SpaceBeforeParens: ControlStatements
# SpaceBeforeParensOptions:
#   AfterControlStatements: true
#   AfterForeachMacros: true
#   AfterFunctionDefinitionName: false
#   AfterFunctionDeclarationName: false
#   AfterIfMacros:   true
#   AfterOverloadedOperator: false
#   AfterPlacementOperator: true
#   AfterRequiresInClause: false
#   AfterRequiresInExpression: false
#   BeforeNonEmptyParentheses: false
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
  AfterRequiresInClause: true
# SpaceBeforeRangeBasedForLoopColon: true
# SpaceBeforeSquareBrackets: false
# SpaceInEmptyBlock: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles:  Never
# SpacesInContainerLiterals: true
# SpacesInLineCommentPrefix:
#   Minimum:         1
#   Maximum:         -1
# SpacesInParens:  Never
# SpacesInParensOptions:
#   ExceptDoubleParentheses: false
#   InCStyleCasts:   false
#   InConditionalStatements: false
#   InEmptyParentheses: false
#   Other:           false
# SpacesInSquareBrackets: false
# Standard:        Latest
# StatementAttributeLikeMacros:
#   - Q_EMIT
# StatementMacros:
#   - Q_UNUSED
#   - QT_REQUIRE_VERSION
# NOTE: _STD_BEGIN, _STD_END, etc. aren't macros for complete statements, but telling
# clang-format that they are produces the behavior that we want (with no block indentation).
StatementMacros:
  - _EXTERN_CXX_WORKAROUND
  - _END_EXTERN_CXX_WORKAROUND
  - _STD_BEGIN
  - _STD_END
  - _STDEXT_BEGIN
  - _STDEXT_END
  - _FMT_P2286_BEGIN
  - _FMT_P2286_END
  - _EXTERN_C_UNLESS_PURE
  - _END_EXTERN_C_UNLESS_PURE
# TableGenBreakInsideDAGArg: DontBreak
# TabWidth:        8
# UseTab:          Never
# VerilogBreakBetweenInstancePorts: true
# WhitespaceSensitiveMacros:
#   - BOOST_PP_STRINGIZE
#   - CF_SWIFT_NAME
#   - NS_SWIFT_NAME
#   - PP_STRINGIZE
#   - STRINGIZE
...
