.clang-format 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. ---
  2. # Refer to the following link for the explanation of each params:
  3. # http://releases.llvm.org/8.0.0/tools/clang/docs/ClangFormatStyleOptions.html
  4. Language: Cpp
  5. # BasedOnStyle: Google
  6. AccessModifierOffset: -4
  7. AlignAfterOpenBracket: Align
  8. AlignConsecutiveAssignments: false
  9. AlignConsecutiveDeclarations: false
  10. AlignEscapedNewlines: Left
  11. AlignOperands: true
  12. AlignTrailingComments: true
  13. AllowAllParametersOfDeclarationOnNextLine: false
  14. AllowShortBlocksOnASingleLine: true
  15. AllowShortCaseLabelsOnASingleLine: true
  16. AllowShortFunctionsOnASingleLine: All
  17. AllowShortIfStatementsOnASingleLine: true
  18. AllowShortLoopsOnASingleLine: true
  19. # This is deprecated
  20. AlwaysBreakAfterDefinitionReturnType: None
  21. AlwaysBreakAfterReturnType: None
  22. AlwaysBreakBeforeMultilineStrings: true
  23. AlwaysBreakTemplateDeclarations: true
  24. BinPackArguments: false
  25. BinPackParameters: false
  26. BraceWrapping:
  27. AfterClass: false
  28. AfterControlStatement: false
  29. AfterEnum: false
  30. AfterFunction: false
  31. AfterNamespace: false
  32. AfterObjCDeclaration: false
  33. AfterStruct: false
  34. AfterUnion: false
  35. AfterExternBlock: false
  36. BeforeCatch: false
  37. BeforeElse: false
  38. IndentBraces: false
  39. # disabling the below splits, else, they'll just add to the vertical length of source files!
  40. SplitEmptyFunction: false
  41. SplitEmptyRecord: false
  42. SplitEmptyNamespace: false
  43. BreakBeforeBinaryOperators: None
  44. BreakBeforeBraces: WebKit
  45. BreakBeforeInheritanceComma: false
  46. BreakInheritanceList: BeforeColon
  47. BreakBeforeTernaryOperators: true
  48. BreakConstructorInitializersBeforeComma: false
  49. BreakConstructorInitializers: BeforeColon
  50. BreakAfterJavaFieldAnnotations: false
  51. BreakStringLiterals: true
  52. ColumnLimit: 100
  53. CommentPragmas: '^ IWYU pragma:'
  54. CompactNamespaces: false
  55. ConstructorInitializerAllOnOneLineOrOnePerLine: true
  56. # Kept the below 2 to be the same as `IndentWidth` to keep everything uniform
  57. ConstructorInitializerIndentWidth: 4
  58. ContinuationIndentWidth: 4
  59. Cpp11BracedListStyle: true
  60. DerivePointerAlignment: false
  61. DisableFormat: false
  62. ExperimentalAutoDetectBinPacking: false
  63. FixNamespaceComments: true
  64. ForEachMacros:
  65. - foreach
  66. - Q_FOREACH
  67. - BOOST_FOREACH
  68. IncludeBlocks: Preserve
  69. IncludeCategories:
  70. - Regex: '^<ext/.*\.h>'
  71. Priority: 2
  72. - Regex: '^<.*\.h>'
  73. Priority: 1
  74. - Regex: '^<.*'
  75. Priority: 2
  76. - Regex: '.*'
  77. Priority: 3
  78. IncludeIsMainRegex: '([-_](test|unittest))?$'
  79. IndentCaseLabels: true
  80. IndentPPDirectives: None
  81. IndentWidth: 4
  82. IndentWrappedFunctionNames: false
  83. JavaScriptQuotes: Leave
  84. JavaScriptWrapImports: true
  85. KeepEmptyLinesAtTheStartOfBlocks: false
  86. MacroBlockBegin: ''
  87. MacroBlockEnd: ''
  88. MaxEmptyLinesToKeep: 1
  89. NamespaceIndentation: None
  90. ObjCBinPackProtocolList: Never
  91. ObjCBlockIndentWidth: 4
  92. ObjCSpaceAfterProperty: false
  93. ObjCSpaceBeforeProtocolList: true
  94. PenaltyBreakAssignment: 4
  95. PenaltyBreakBeforeFirstCallParameter: 1
  96. PenaltyBreakComment: 300
  97. PenaltyBreakFirstLessLess: 120
  98. PenaltyBreakString: 1000
  99. PenaltyBreakTemplateDeclaration: 10
  100. PenaltyExcessCharacter: 1000000
  101. PenaltyReturnTypeOnItsOwnLine: 200
  102. PointerAlignment: Left
  103. RawStringFormats:
  104. - Language: Cpp
  105. Delimiters:
  106. - cc
  107. - CC
  108. - cpp
  109. - Cpp
  110. - CPP
  111. - 'c++'
  112. - 'C++'
  113. CanonicalDelimiter: ''
  114. - Language: TextProto
  115. Delimiters:
  116. - pb
  117. - PB
  118. - proto
  119. - PROTO
  120. EnclosingFunctions:
  121. - EqualsProto
  122. - EquivToProto
  123. - PARSE_PARTIAL_TEXT_PROTO
  124. - PARSE_TEST_PROTO
  125. - PARSE_TEXT_PROTO
  126. - ParseTextOrDie
  127. - ParseTextProtoOrDie
  128. CanonicalDelimiter: ''
  129. BasedOnStyle: google
  130. # Enabling comment reflow causes doxygen comments to be messed up in their formats!
  131. ReflowComments: true
  132. SortIncludes: true
  133. SortUsingDeclarations: true
  134. SpaceAfterCStyleCast: false
  135. SpaceAfterTemplateKeyword: true
  136. SpaceBeforeAssignmentOperators: true
  137. SpaceBeforeCpp11BracedList: false
  138. SpaceBeforeCtorInitializerColon: true
  139. SpaceBeforeInheritanceColon: true
  140. SpaceBeforeParens: ControlStatements
  141. SpaceBeforeRangeBasedForLoopColon: true
  142. SpaceInEmptyParentheses: false
  143. SpacesBeforeTrailingComments: 2
  144. SpacesInAngles: false
  145. SpacesInContainerLiterals: true
  146. SpacesInCStyleCastParentheses: false
  147. SpacesInParentheses: false
  148. SpacesInSquareBrackets: false
  149. Standard: Cpp11
  150. StatementMacros:
  151. - Q_UNUSED
  152. - QT_REQUIRE_VERSION
  153. # Be consistent with indent-width, even for people who use tab for indentation!
  154. TabWidth: 4
  155. UseTab: Never