.clang-format 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. ---
  2. # Typical usage is to apply this to the lines you've modified in a local
  3. # change. Stage your changes with "git add" and then run:
  4. # $ git clang-format
  5. # You can optionally use the "--" file filter to restrict formatting to certain
  6. # files or directories. The tool will display the list of files that were
  7. # modified. These have been modified without being staged. You can review the
  8. # modifications using "git diff".
  9. #
  10. # IF YOU UPDATE THE CPP SECTION ALSO UPDATE THE OBJECTIVE-C SECTION. IF YOU
  11. # KNOW HOW TO SHARE SETTINGS BETWEEN THE TWO YOU'RE A TRUE HERO.
  12. Language: Cpp
  13. # BasedOnStyle: Google
  14. AccessModifierOffset: -4
  15. AlignAfterOpenBracket: Align
  16. AlignConsecutiveAssignments: false
  17. AlignConsecutiveDeclarations: false
  18. AlignEscapedNewlinesLeft: true
  19. AlignOperands: true
  20. AlignTrailingComments: true
  21. AllowAllParametersOfDeclarationOnNextLine: true
  22. AllowShortBlocksOnASingleLine: false
  23. AllowShortCaseLabelsOnASingleLine: false
  24. AllowShortFunctionsOnASingleLine: All
  25. AllowShortIfStatementsOnASingleLine: true
  26. AllowShortLoopsOnASingleLine: true
  27. AlwaysBreakAfterDefinitionReturnType: None
  28. AlwaysBreakAfterReturnType: None
  29. AlwaysBreakBeforeMultilineStrings: true
  30. AlwaysBreakTemplateDeclarations: false
  31. BinPackArguments: true
  32. BinPackParameters: true
  33. BraceWrapping:
  34. AfterClass: false
  35. AfterControlStatement: false
  36. AfterEnum: false
  37. AfterFunction: false
  38. AfterNamespace: false
  39. AfterObjCDeclaration: false
  40. AfterStruct: false
  41. AfterUnion: false
  42. BeforeCatch: false
  43. BeforeElse: false
  44. IndentBraces: false
  45. BreakBeforeBinaryOperators: None
  46. BreakBeforeBraces: Custom
  47. BreakBeforeTernaryOperators: true
  48. BreakConstructorInitializersBeforeComma: true
  49. BreakAfterJavaFieldAnnotations: false
  50. BreakStringLiterals: true
  51. ColumnLimit: 100
  52. CommentPragmas: '^ IWYU pragma:'
  53. ConstructorInitializerAllOnOneLineOrOnePerLine: true
  54. ConstructorInitializerIndentWidth: 8
  55. ContinuationIndentWidth: 8
  56. Cpp11BracedListStyle: true
  57. DerivePointerAlignment: false
  58. DisableFormat: false
  59. ExperimentalAutoDetectBinPacking: true
  60. ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
  61. IncludeCategories:
  62. - Regex: '^<.*\.h>'
  63. Priority: 1
  64. - Regex: '^<.*'
  65. Priority: 2
  66. - Regex: '.*'
  67. Priority: 3
  68. IncludeIsMainRegex: '([-_](test|unittest))?$'
  69. IndentCaseLabels: true
  70. IndentWidth: 4
  71. IndentWrappedFunctionNames: false
  72. JavaScriptQuotes: Leave
  73. JavaScriptWrapImports: true
  74. KeepEmptyLinesAtTheStartOfBlocks: false
  75. MaxEmptyLinesToKeep: 1
  76. NamespaceIndentation: None
  77. ObjCBlockIndentWidth: 2
  78. ObjCSpaceAfterProperty: false
  79. ObjCSpaceBeforeProtocolList: false
  80. PenaltyBreakBeforeFirstCallParameter: 1
  81. PenaltyBreakComment: 300
  82. PenaltyBreakFirstLessLess: 120
  83. PenaltyBreakString: 1000
  84. PenaltyExcessCharacter: 1000000
  85. PenaltyReturnTypeOnItsOwnLine: 200
  86. PointerAlignment: Left
  87. ReflowComments: true
  88. SortIncludes: true
  89. SpaceAfterCStyleCast: false
  90. SpaceAfterTemplateKeyword: true
  91. SpaceBeforeAssignmentOperators: true
  92. SpaceBeforeParens: ControlStatements
  93. SpaceInEmptyParentheses: false
  94. SpacesBeforeTrailingComments: 2
  95. SpacesInAngles: false
  96. SpacesInContainerLiterals: true
  97. SpacesInCStyleCastParentheses: false
  98. SpacesInParentheses: false
  99. SpacesInSquareBrackets: false
  100. Standard: Auto
  101. TabWidth: 4
  102. UseTab: Never
  103. ---
  104. Language: ObjC
  105. AccessModifierOffset: -4
  106. AlignAfterOpenBracket: Align
  107. AlignConsecutiveAssignments: false
  108. AlignConsecutiveDeclarations: false
  109. AlignEscapedNewlinesLeft: true
  110. AlignOperands: true
  111. AlignTrailingComments: true
  112. AllowAllParametersOfDeclarationOnNextLine: true
  113. AllowShortBlocksOnASingleLine: false
  114. AllowShortCaseLabelsOnASingleLine: false
  115. AllowShortFunctionsOnASingleLine: All
  116. AllowShortIfStatementsOnASingleLine: true
  117. AllowShortLoopsOnASingleLine: true
  118. AlwaysBreakAfterDefinitionReturnType: None
  119. AlwaysBreakAfterReturnType: None
  120. AlwaysBreakBeforeMultilineStrings: true
  121. AlwaysBreakTemplateDeclarations: false
  122. BinPackArguments: true
  123. BinPackParameters: true
  124. BraceWrapping:
  125. AfterClass: false
  126. AfterControlStatement: false
  127. AfterEnum: false
  128. AfterFunction: false
  129. AfterNamespace: false
  130. AfterObjCDeclaration: false
  131. AfterStruct: false
  132. AfterUnion: false
  133. BeforeCatch: false
  134. BeforeElse: false
  135. IndentBraces: false
  136. BreakBeforeBinaryOperators: None
  137. BreakBeforeBraces: Custom
  138. BreakBeforeTernaryOperators: true
  139. BreakConstructorInitializersBeforeComma: true
  140. BreakAfterJavaFieldAnnotations: false
  141. BreakStringLiterals: true
  142. ColumnLimit: 100
  143. CommentPragmas: '^ IWYU pragma:'
  144. ConstructorInitializerAllOnOneLineOrOnePerLine: true
  145. ConstructorInitializerIndentWidth: 8
  146. ContinuationIndentWidth: 8
  147. Cpp11BracedListStyle: true
  148. DerivePointerAlignment: false
  149. DisableFormat: false
  150. ExperimentalAutoDetectBinPacking: true
  151. ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
  152. IncludeCategories:
  153. - Regex: '^<.*\.h>'
  154. Priority: 1
  155. - Regex: '^<.*'
  156. Priority: 2
  157. - Regex: '.*'
  158. Priority: 3
  159. IncludeIsMainRegex: '([-_](test|unittest))?$'
  160. IndentCaseLabels: true
  161. IndentWidth: 4
  162. IndentWrappedFunctionNames: false
  163. JavaScriptQuotes: Leave
  164. JavaScriptWrapImports: true
  165. KeepEmptyLinesAtTheStartOfBlocks: false
  166. MaxEmptyLinesToKeep: 1
  167. NamespaceIndentation: None
  168. ObjCBlockIndentWidth: 2
  169. ObjCSpaceAfterProperty: false
  170. ObjCSpaceBeforeProtocolList: false
  171. PenaltyBreakBeforeFirstCallParameter: 1
  172. PenaltyBreakComment: 300
  173. PenaltyBreakFirstLessLess: 120
  174. PenaltyBreakString: 1000
  175. PenaltyExcessCharacter: 1000000
  176. PenaltyReturnTypeOnItsOwnLine: 200
  177. PointerAlignment: Left
  178. ReflowComments: true
  179. SortIncludes: true
  180. SpaceAfterCStyleCast: false
  181. SpaceAfterTemplateKeyword: true
  182. SpaceBeforeAssignmentOperators: true
  183. SpaceBeforeParens: ControlStatements
  184. SpaceInEmptyParentheses: false
  185. SpacesBeforeTrailingComments: 2
  186. SpacesInAngles: false
  187. SpacesInContainerLiterals: true
  188. SpacesInCStyleCastParentheses: false
  189. SpacesInParentheses: false
  190. SpacesInSquareBrackets: false
  191. Standard: Auto
  192. TabWidth: 4
  193. UseTab: Never
  194. ...