.clang-format 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. ---
  2. Language: Cpp
  3. AlignAfterOpenBracket: Align
  4. AlignArrayOfStructures: Left
  5. AlignConsecutiveAssignments: AcrossComments
  6. AlignConsecutiveBitFields: AcrossComments
  7. AlignConsecutiveDeclarations: AcrossComments
  8. AlignConsecutiveMacros: AcrossComments
  9. # AlignConsecutiveShortCaseStatements: AcrossComments
  10. AlignEscapedNewlines: Left # LeftWithLastLine
  11. AlignOperands: Align
  12. AlignTrailingComments:
  13. Kind: Always
  14. OverEmptyLines: 1
  15. AllowAllArgumentsOnNextLine: true
  16. AllowAllParametersOfDeclarationOnNextLine: false
  17. # AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
  18. AllowShortBlocksOnASingleLine: Never
  19. AllowShortCaseLabelsOnASingleLine: false
  20. AllowShortFunctionsOnASingleLine: Inline
  21. AllowShortIfStatementsOnASingleLine: Never
  22. AllowShortLambdasOnASingleLine: Inline
  23. AllowShortLoopsOnASingleLine: false
  24. AlwaysBreakBeforeMultilineStrings: true
  25. # Treat CUDA keywords/attributes as "attribute macros" and avoid breaking lines inside them
  26. AttributeMacros:
  27. - __host__
  28. - __device__
  29. - __global__
  30. - __forceinline__
  31. - __launch_bounds__
  32. BinPackArguments: true
  33. BinPackParameters: false # OnePerLine
  34. BitFieldColonSpacing: Both
  35. BreakBeforeBraces: Custom # Attach
  36. BraceWrapping:
  37. AfterCaseLabel: true
  38. AfterClass: false
  39. AfterControlStatement: false
  40. AfterEnum: false
  41. AfterFunction: false
  42. AfterNamespace: false
  43. AfterObjCDeclaration: false
  44. AfterStruct: false
  45. AfterUnion: false
  46. AfterExternBlock: false
  47. BeforeCatch: false
  48. BeforeElse: false
  49. BeforeLambdaBody: false
  50. BeforeWhile: false
  51. IndentBraces: false
  52. SplitEmptyFunction: false
  53. SplitEmptyRecord: false
  54. SplitEmptyNamespace: false
  55. # BreakAdjacentStringLiterals: true
  56. BreakAfterAttributes: Never
  57. BreakBeforeBinaryOperators: None
  58. BreakBeforeInlineASMColon: OnlyMultiline
  59. BreakBeforeTernaryOperators: false
  60. # BreakBinaryOperations: Never
  61. BreakConstructorInitializers: AfterColon
  62. # BreakFunctionDefinitionParameters: false
  63. BreakInheritanceList: AfterComma
  64. BreakStringLiterals: true
  65. # BreakTemplateDeclarations: Yes
  66. ColumnLimit: 120
  67. CommentPragmas: '^ IWYU pragma:'
  68. CompactNamespaces: false
  69. ConstructorInitializerIndentWidth: 4
  70. ContinuationIndentWidth: 4
  71. Cpp11BracedListStyle: false
  72. DerivePointerAlignment: false
  73. DisableFormat: false
  74. EmptyLineBeforeAccessModifier: Leave
  75. EmptyLineAfterAccessModifier: Never
  76. ExperimentalAutoDetectBinPacking: false
  77. FixNamespaceComments: true
  78. IncludeBlocks: Regroup
  79. IncludeCategories:
  80. - Regex: '".*"'
  81. Priority: 1
  82. SortPriority: 0
  83. - Regex: '^<.*\.h>'
  84. Priority: 2
  85. SortPriority: 0
  86. - Regex: '^<.*'
  87. Priority: 3
  88. SortPriority: 0
  89. - Regex: '.*'
  90. Priority: 4
  91. SortPriority: 0
  92. IncludeIsMainRegex: '([-_](test|unittest))?$'
  93. IncludeIsMainSourceRegex: ''
  94. IndentAccessModifiers: false
  95. IndentCaseBlocks: true
  96. IndentCaseLabels: true
  97. IndentExternBlock: NoIndent
  98. IndentGotoLabels: false
  99. IndentPPDirectives: AfterHash
  100. IndentWidth: 4
  101. IndentWrappedFunctionNames: false
  102. InsertBraces: true # NOTE: may lead to incorrect formatting
  103. InsertNewlineAtEOF: true
  104. JavaScriptQuotes: Leave
  105. JavaScriptWrapImports: true
  106. KeepEmptyLinesAtTheStartOfBlocks: false
  107. LambdaBodyIndentation: Signature
  108. LineEnding: LF
  109. MacroBlockBegin: ''
  110. MacroBlockEnd: ''
  111. MaxEmptyLinesToKeep: 1
  112. NamespaceIndentation: None
  113. ObjCBinPackProtocolList: Auto
  114. ObjCBlockIndentWidth: 4
  115. ObjCSpaceAfterProperty: true
  116. ObjCSpaceBeforeProtocolList: true
  117. PPIndentWidth: -1
  118. PackConstructorInitializers: CurrentLine
  119. PenaltyBreakAssignment: 2
  120. PenaltyBreakBeforeFirstCallParameter: 1
  121. PenaltyBreakComment: 300
  122. PenaltyBreakFirstLessLess: 120
  123. PenaltyBreakString: 1000
  124. PenaltyBreakTemplateDeclaration: 10
  125. PenaltyExcessCharacter: 1000000
  126. PenaltyReturnTypeOnItsOwnLine: 200
  127. PointerAlignment: Middle
  128. QualifierAlignment: Left
  129. #QualifierOrder: ['static', 'inline', 'friend', 'constexpr', 'const', 'volatile', 'type', 'restrict']
  130. RawStringFormats:
  131. - Language: Cpp
  132. Delimiters:
  133. - cc
  134. - CC
  135. - cpp
  136. - Cpp
  137. - CPP
  138. - 'c++'
  139. - 'C++'
  140. CanonicalDelimiter: ''
  141. ReferenceAlignment: Middle
  142. ReflowComments: false # IndentOnly
  143. SeparateDefinitionBlocks: Always
  144. SortIncludes: CaseInsensitive
  145. SortUsingDeclarations: LexicographicNumeric
  146. SpaceAfterCStyleCast: true
  147. SpaceAfterLogicalNot: false
  148. SpaceAfterTemplateKeyword: true
  149. SpaceBeforeAssignmentOperators: true
  150. SpaceBeforeCpp11BracedList: false
  151. SpaceBeforeCtorInitializerColon: true
  152. SpaceBeforeInheritanceColon: true
  153. SpaceBeforeParens: ControlStatements
  154. SpaceBeforeRangeBasedForLoopColon: true
  155. SpaceInEmptyBlock: false
  156. SpaceInEmptyParentheses: false
  157. SpacesBeforeTrailingComments: 2
  158. SpacesInAngles: Never
  159. SpacesInContainerLiterals: true
  160. SpacesInLineCommentPrefix:
  161. Minimum: 1
  162. Maximum: -1
  163. SpacesInParentheses: false
  164. SpacesInSquareBrackets: false
  165. SpaceBeforeSquareBrackets: false
  166. Standard: c++17
  167. TabWidth: 4
  168. UseTab: Never
  169. WhitespaceSensitiveMacros: ['STRINGIZE']
  170. ...