---
# Refer to the following link for the explanation of each params:
#   http://releases.llvm.org/12.0.0/tools/clang/docs/ClangFormatStyleOptions.html
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false # Allows placing breakpoint
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
# This is deprecated
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments:  false
BinPackParameters: false
BraceWrapping:
  AfterClass:            true
  AfterControlStatement: true
  AfterEnum:             true
  AfterFunction:         true
  AfterNamespace:        false
  AfterObjCDeclaration:  false
  AfterStruct:           true
  AfterUnion:            true
  AfterExternBlock:      false
  BeforeCatch:           false
  BeforeElse:            true
  IndentBraces:          false
  # disabling the below splits, else, they'll just add to the vertical length of source files!
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
# Kept the below 2 to be the same as `IndentWidth` to keep everything uniform
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
  - foreach
  - Q_FOREACH
  - BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
  # The order of the groups is
  # 0 - Main include file for .cpp
  # 1 - source relative files `#include "./some_header.hpp"` (Grouped with 2)
  # 2 - source relative files starting with internal/public `#include "internal/some_header.hpp"`
  # 3 - Python MRC public API files `#include "pymrc/mrc_header.hpp"`
  # 4 - MRC public API files `#include "mrc/mrc_header.hpp"`
  # 5 - NVRPC public API files `#include "nvrpc/some_header.hpp"`
  # 6 - External installed libraries `#include <external_lib/some_header.hpp>`
  # 7 - System includes `#include <string>`
  # First match any Python MRC public API headers with quotes
  - Regex:           '^"pymrc\/.*\.(h|hpp)"'
    Priority:        3
  # Next match any MRC public API headers with quotes
  - Regex:           '^"mrc\/.*\.(h|hpp)"'
    Priority:        4
  # Next match public NVRPC headers with quotes
  - Regex:           '^<nvrpc\/.*\.(h|hpp)>'
    Priority:        5
  # Next find any headers in internal or public
  - Regex:           '^"(internal|public)\/.*\.(h|hpp)"'
    Priority:        2
  # Any other quoted includes need to be with internal/public but on top (Thats why this group is last)
  - Regex:           '^".*\.(h|hpp)"'
    Priority:        1
  # Last is system includes which dont have a '/' like <string> or <mutex>
  - Regex:           '<([a-z_])+>'
    Priority:        7
  # Finally, put all 3rd party includes before the system includes
  - Regex:           '^<.*'
    Priority:        6
# IncludeIsMainSourceRegex: '$?'
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseBlocks: false
IndentCaseLabels: false
IndentPPDirectives: BeforeHash
IndentWidth:     4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd:   ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: CurrentLine
PenaltyBreakAssignment: 80
PenaltyBreakBeforeFirstCallParameter: 0
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 10
PenaltyBreakString: 0
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 600
PointerAlignment: Left
RawStringFormats:
  - Language: Cpp
    Delimiters:
      - cc
      - CC
      - cpp
      - Cpp
      - CPP
      - 'c++'
      - 'C++'
    CanonicalDelimiter: ''
  - Language: TextProto
    Delimiters:
      - pb
      - PB
      - proto
      - PROTO
    EnclosingFunctions:
      - EqualsProto
      - EquivToProto
      - PARSE_PARTIAL_TEXT_PROTO
      - PARSE_TEST_PROTO
      - PARSE_TEXT_PROTO
      - ParseTextOrDie
      - ParseTextProtoOrDie
    CanonicalDelimiter: ''
    BasedOnStyle: google
# Enabling comment reflow causes doxygen comments to be messed up in their formats!
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++20
StatementMacros:
  - Q_UNUSED
  - QT_REQUIRE_VERSION
# Be consistent with indent-width, even for people who use tab for indentation!
TabWidth: 4
UseTab: Never
