|
| 1 | +# Checkout config tool: https://zed0.co.uk/clang-format-configurator/ |
| 2 | +# Or http://cf.monofraps.net/ |
| 3 | +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html |
| 4 | +# https://github.com/01org/parameter-framework/blob/master/.clang-format |
| 5 | + |
| 6 | +# Tested on: clang-format version 6.0.1 |
| 7 | + |
| 8 | + |
| 9 | +# Common settings |
| 10 | +BasedOnStyle: WebKit |
| 11 | +TabWidth: 4 |
| 12 | +IndentWidth: 4 |
| 13 | +UseTab: Never |
| 14 | +ColumnLimit: 140 |
| 15 | + |
| 16 | +# Other languages JavaScript, Proto |
| 17 | + |
| 18 | +--- |
| 19 | +Language: Cpp |
| 20 | + |
| 21 | +# http://releases.llvm.org/6.0.1/tools/clang/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code |
| 22 | +# int formatted_code; |
| 23 | +# // clang-format off |
| 24 | +# void unformatted_code ; |
| 25 | +# // clang-format on |
| 26 | +# void formatted_code_again; |
| 27 | + |
| 28 | +DisableFormat: false |
| 29 | +Standard: Cpp11 |
| 30 | + |
| 31 | +AccessModifierOffset: -4 |
| 32 | +AlignAfterOpenBracket: true |
| 33 | +AlignConsecutiveAssignments: true |
| 34 | +AlignConsecutiveDeclarations: true |
| 35 | +AlignEscapedNewlinesLeft: false |
| 36 | +AlignOperands: true |
| 37 | +AlignTrailingComments: false |
| 38 | +AllowAllParametersOfDeclarationOnNextLine: true |
| 39 | +AllowShortBlocksOnASingleLine: false |
| 40 | +AllowShortCaseLabelsOnASingleLine: false |
| 41 | +AllowShortFunctionsOnASingleLine: Empty |
| 42 | +AllowShortIfStatementsOnASingleLine: false |
| 43 | +AllowShortLoopsOnASingleLine: false |
| 44 | +AlwaysBreakAfterDefinitionReturnType: false |
| 45 | +AlwaysBreakAfterReturnType: None |
| 46 | +AlwaysBreakBeforeMultilineStrings: false |
| 47 | +AlwaysBreakTemplateDeclarations: true |
| 48 | +BinPackArguments: false |
| 49 | +BinPackParameters: false |
| 50 | + |
| 51 | +# Configure each individual brace in BraceWrapping |
| 52 | +BreakBeforeBraces: Custom |
| 53 | +# Control of individual brace wrapping cases |
| 54 | +BraceWrapping: { |
| 55 | + AfterClass: 'true' |
| 56 | + AfterControlStatement: 'true' |
| 57 | + AfterEnum : 'true' |
| 58 | + AfterFunction : 'true' |
| 59 | + AfterNamespace : 'true' |
| 60 | + AfterStruct : 'true' |
| 61 | + AfterUnion : 'true' |
| 62 | + BeforeCatch : 'true' |
| 63 | + BeforeElse : 'true' |
| 64 | + IndentBraces : 'false' |
| 65 | + AfterExternBlock : 'true' |
| 66 | + SplitEmptyFunction : 'false' |
| 67 | + SplitEmptyRecord : 'false' |
| 68 | + SplitEmptyNamespace : 'true' |
| 69 | +} |
| 70 | + |
| 71 | +BreakAfterJavaFieldAnnotations: true |
| 72 | +BreakBeforeInheritanceComma: false |
| 73 | +BreakBeforeBinaryOperators: None |
| 74 | +BreakBeforeTernaryOperators: true |
| 75 | +BreakConstructorInitializers: AfterColon |
| 76 | +BreakStringLiterals: true |
| 77 | + |
| 78 | +CommentPragmas: '^ IWYU pragma:' |
| 79 | +CompactNamespaces: false |
| 80 | +ConstructorInitializerAllOnOneLineOrOnePerLine: false |
| 81 | +ConstructorInitializerIndentWidth: 4 |
| 82 | +ContinuationIndentWidth: 4 |
| 83 | +Cpp11BracedListStyle: true |
| 84 | +DerivePointerAlignment: false |
| 85 | +ExperimentalAutoDetectBinPacking: false |
| 86 | +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] |
| 87 | +IndentCaseLabels: false |
| 88 | +FixNamespaceComments: true |
| 89 | +IndentWrappedFunctionNames: false |
| 90 | +KeepEmptyLinesAtTheStartOfBlocks: true |
| 91 | +MacroBlockBegin: '' |
| 92 | +MacroBlockEnd: '' |
| 93 | +JavaScriptQuotes: Double |
| 94 | +MaxEmptyLinesToKeep: 1 |
| 95 | +NamespaceIndentation: None |
| 96 | +ObjCBlockIndentWidth: 4 |
| 97 | +ObjCSpaceAfterProperty: true |
| 98 | +ObjCSpaceBeforeProtocolList: true |
| 99 | +PenaltyBreakBeforeFirstCallParameter: 19 |
| 100 | +PenaltyBreakComment: 300 |
| 101 | +PenaltyBreakFirstLessLess: 120 |
| 102 | +PenaltyBreakString: 1000 |
| 103 | + |
| 104 | +PenaltyExcessCharacter: 1000000 |
| 105 | +PenaltyReturnTypeOnItsOwnLine: 60 |
| 106 | +PointerAlignment: Left |
| 107 | +SpaceAfterCStyleCast: false |
| 108 | +SpaceBeforeAssignmentOperators: true |
| 109 | +SpaceBeforeParens: Never |
| 110 | +SpaceInEmptyParentheses: false |
| 111 | +SpacesBeforeTrailingComments: 1 |
| 112 | +SpacesInAngles: false |
| 113 | +SpacesInContainerLiterals: true |
| 114 | +SpacesInCStyleCastParentheses: false |
| 115 | +SpacesInParentheses: false |
| 116 | +SpacesInSquareBrackets: false |
| 117 | +SpaceAfterTemplateKeyword: true |
| 118 | + |
| 119 | +SortUsingDeclarations: false |
| 120 | +SortIncludes: false |
| 121 | + |
| 122 | +# Comments are for developers, they should arrange them |
| 123 | +ReflowComments: false |
| 124 | + |
| 125 | +IncludeBlocks: Preserve |
| 126 | +IndentPPDirectives: None |
| 127 | +--- |
0 commit comments