1b1b8bc3fSopenharmony_ci# Copyright (C) 2022 Huawei Device Co., Ltd. 2b1b8bc3fSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3b1b8bc3fSopenharmony_ci# you may not use this file except in compliance with the License. 4b1b8bc3fSopenharmony_ci# You may obtain a copy of the License at 5b1b8bc3fSopenharmony_ci# 6b1b8bc3fSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7b1b8bc3fSopenharmony_ci# 8b1b8bc3fSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9b1b8bc3fSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10b1b8bc3fSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11b1b8bc3fSopenharmony_ci# See the License for the specific language governing permissions and 12b1b8bc3fSopenharmony_ci# limitations under the License. 13b1b8bc3fSopenharmony_ci 14b1b8bc3fSopenharmony_ciLanguage: Cpp 15b1b8bc3fSopenharmony_ci# BasedOnStyle: LLVM 16b1b8bc3fSopenharmony_ci# 访问说明符(public、private等)的偏移 17b1b8bc3fSopenharmony_ciAccessModifierOffset: -4 18b1b8bc3fSopenharmony_ci# 开括号(开圆括号、开尖括号、开方括号)后的对齐 19b1b8bc3fSopenharmony_ciAlignAfterOpenBracket: Align 20b1b8bc3fSopenharmony_ci# 连续赋值时,等号对齐 21b1b8bc3fSopenharmony_ciAlignConsecutiveAssignments: false 22b1b8bc3fSopenharmony_ci# 连续赋值时,变量名对齐 23b1b8bc3fSopenharmony_ciAlignConsecutiveDeclarations: false 24b1b8bc3fSopenharmony_ci# 左对齐逃脱换行(使用反斜杠换行)的反斜杠 25b1b8bc3fSopenharmony_ciAlignEscapedNewlinesLeft: true 26b1b8bc3fSopenharmony_ci# 水平对齐二元和三元表达式的操作数 27b1b8bc3fSopenharmony_ciAlignOperands: true 28b1b8bc3fSopenharmony_ci# 对齐连续的尾随的注释 29b1b8bc3fSopenharmony_ciAlignTrailingComments: true 30b1b8bc3fSopenharmony_ci# 允许函数声明的所有参数在放在下一行 31b1b8bc3fSopenharmony_ciAllowAllParametersOfDeclarationOnNextLine: false 32b1b8bc3fSopenharmony_ci# 允许短的块放在同一行 33b1b8bc3fSopenharmony_ciAllowShortBlocksOnASingleLine: false 34b1b8bc3fSopenharmony_ci# 允许短的case标签放在同一行 35b1b8bc3fSopenharmony_ciAllowShortCaseLabelsOnASingleLine: false 36b1b8bc3fSopenharmony_ci# 允许短的函数放在同一行: None, InlineOnly(定义在类中), Empty(空函数), Inline(定义在类中,空函数), All 37b1b8bc3fSopenharmony_ciAllowShortFunctionsOnASingleLine: Empty 38b1b8bc3fSopenharmony_ci# 允许短的if语句保持在同一行 39b1b8bc3fSopenharmony_ciAllowShortIfStatementsOnASingleLine: false 40b1b8bc3fSopenharmony_ci# 允许短的循环保持在同一行 41b1b8bc3fSopenharmony_ciAllowShortLoopsOnASingleLine: false 42b1b8bc3fSopenharmony_ci# 总是在定义返回类型后换行(deprecated) 43b1b8bc3fSopenharmony_ciAlwaysBreakAfterDefinitionReturnType: None 44b1b8bc3fSopenharmony_ci# 总是在返回类型后换行: None, All, TopLevel(顶级函数,不包括在类中的函数), 45b1b8bc3fSopenharmony_ci# AllDefinitions(所有的定义,不包括声明), TopLevelDefinitions(所有的顶级函数的定义) 46b1b8bc3fSopenharmony_ciAlwaysBreakAfterReturnType: None 47b1b8bc3fSopenharmony_ci# 总是在多行string字面量前换行 48b1b8bc3fSopenharmony_ciAlwaysBreakBeforeMultilineStrings: true 49b1b8bc3fSopenharmony_ci# 总是在template声明后换行 50b1b8bc3fSopenharmony_ciAlwaysBreakTemplateDeclarations: false 51b1b8bc3fSopenharmony_ci# false表示函数实参要么都在同一行,要么都各自一行 52b1b8bc3fSopenharmony_ciBinPackArguments: true 53b1b8bc3fSopenharmony_ci# false表示所有形参要么都在同一行,要么都各自一行 54b1b8bc3fSopenharmony_ciBinPackParameters: true 55b1b8bc3fSopenharmony_ci# 大括号换行,只有当BreakBeforeBraces设置为Custom时才有效 56b1b8bc3fSopenharmony_ciBraceWrapping: 57b1b8bc3fSopenharmony_ci AfterClass: false 58b1b8bc3fSopenharmony_ci AfterControlStatement: false 59b1b8bc3fSopenharmony_ci AfterEnum: false 60b1b8bc3fSopenharmony_ci AfterFunction: true 61b1b8bc3fSopenharmony_ci AfterNamespace: false 62b1b8bc3fSopenharmony_ci AfterObjCDeclaration: false 63b1b8bc3fSopenharmony_ci AfterStruct: false 64b1b8bc3fSopenharmony_ci AfterUnion: false 65b1b8bc3fSopenharmony_ci BeforeCatch: false 66b1b8bc3fSopenharmony_ci BeforeElse: false 67b1b8bc3fSopenharmony_ci IndentBraces: false 68b1b8bc3fSopenharmony_ci# 在二元运算符前换行: None(在操作符后换行), NonAssignment(在非赋值的操作符前换行), All(在操作符前换行) 69b1b8bc3fSopenharmony_ciBreakBeforeBinaryOperators: None 70b1b8bc3fSopenharmony_ci# 在大括号前换行: Attach(始终将大括号附加到周围的上下文), Linux(除函数、命名空间和类定义,与Attach类似), 71b1b8bc3fSopenharmony_ci# Mozilla(除枚举、函数、记录定义,与Attach类似), Stroustrup(除函数定义、catch、else,与Attach类似), 72b1b8bc3fSopenharmony_ci# Allman(总是在大括号前换行), GNU(总是在大括号前换行,并对于控制语句的大括号增加额外的缩进), WebKit(在函数前换行), Custom 73b1b8bc3fSopenharmony_ci# 注:这里认为语句块也属于函数 74b1b8bc3fSopenharmony_ciBreakBeforeBraces: Custom 75b1b8bc3fSopenharmony_ci# 在三元运算符前换行 76b1b8bc3fSopenharmony_ciBreakBeforeTernaryOperators: true 77b1b8bc3fSopenharmony_ci# 在构造函数的初始化列表的逗号前换行 78b1b8bc3fSopenharmony_ciBreakConstructorInitializersBeforeComma: false 79b1b8bc3fSopenharmony_ci# 每行字符的限制,0表示没有限制 80b1b8bc3fSopenharmony_ciColumnLimit: 120 81b1b8bc3fSopenharmony_ci# 描述具有特殊意义的注释的正则表达式,它不应该被分割为多行或以其它方式改变 82b1b8bc3fSopenharmony_ciCommentPragmas: "^ IWYU pragma:" 83b1b8bc3fSopenharmony_ci# 构造函数的初始化列表要么都在同一行,要么都各自一行 84b1b8bc3fSopenharmony_ciConstructorInitializerAllOnOneLineOrOnePerLine: true 85b1b8bc3fSopenharmony_ci# 构造函数的初始化列表的缩进宽度 86b1b8bc3fSopenharmony_ciConstructorInitializerIndentWidth: 4 87b1b8bc3fSopenharmony_ci# 延续的行的缩进宽度 88b1b8bc3fSopenharmony_ciContinuationIndentWidth: 4 89b1b8bc3fSopenharmony_ci# 去除C++11的列表初始化的大括号{后和}前的空格 90b1b8bc3fSopenharmony_ciCpp11BracedListStyle: true 91b1b8bc3fSopenharmony_ci# 继承最常用的指针和引用的对齐方式 92b1b8bc3fSopenharmony_ciDerivePointerAlignment: false 93b1b8bc3fSopenharmony_ci# 关闭格式化 94b1b8bc3fSopenharmony_ciDisableFormat: false 95b1b8bc3fSopenharmony_ci# 自动检测函数的调用和定义是否被格式为每行一个参数(Experimental) 96b1b8bc3fSopenharmony_ciExperimentalAutoDetectBinPacking: false 97b1b8bc3fSopenharmony_ci# 需要被解读为foreach循环而不是函数调用的宏 98b1b8bc3fSopenharmony_ciForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] 99b1b8bc3fSopenharmony_ci# 对#include进行排序,匹配了某正则表达式的#include拥有对应的优先级,匹配不到的则默认优先级为INT_MAX(优先级越小排序越靠前), 100b1b8bc3fSopenharmony_ci# 可以定义负数优先级从而保证某些#include永远在最前面 101b1b8bc3fSopenharmony_ciIncludeCategories: 102b1b8bc3fSopenharmony_ci - Regex: '^"(llvm|llvm-c|clang|clang-c)/' 103b1b8bc3fSopenharmony_ci Priority: 2 104b1b8bc3fSopenharmony_ci - Regex: '^(<|"(gtest|isl|json)/)' 105b1b8bc3fSopenharmony_ci Priority: 3 106b1b8bc3fSopenharmony_ci - Regex: ".*" 107b1b8bc3fSopenharmony_ci Priority: 1 108b1b8bc3fSopenharmony_ci# 缩进case标签 109b1b8bc3fSopenharmony_ciIndentCaseLabels: true 110b1b8bc3fSopenharmony_ci# 缩进宽度 111b1b8bc3fSopenharmony_ciIndentWidth: 4 112b1b8bc3fSopenharmony_ci# 函数返回类型换行时,缩进函数声明或函数定义的函数名 113b1b8bc3fSopenharmony_ciIndentWrappedFunctionNames: true 114b1b8bc3fSopenharmony_ci# 保留在块开始处的空行 115b1b8bc3fSopenharmony_ciKeepEmptyLinesAtTheStartOfBlocks: true 116b1b8bc3fSopenharmony_ci# 开始一个块的宏的正则表达式 117b1b8bc3fSopenharmony_ciMacroBlockBegin: "" 118b1b8bc3fSopenharmony_ci# 结束一个块的宏的正则表达式 119b1b8bc3fSopenharmony_ciMacroBlockEnd: "" 120b1b8bc3fSopenharmony_ci# 连续空行的最大数量 121b1b8bc3fSopenharmony_ciMaxEmptyLinesToKeep: 1 122b1b8bc3fSopenharmony_ci# 命名空间的缩进: None, Inner(缩进嵌套的命名空间中的内容), All 123b1b8bc3fSopenharmony_ciNamespaceIndentation: None 124b1b8bc3fSopenharmony_ci# 使用ObjC块时缩进宽度 125b1b8bc3fSopenharmony_ciObjCBlockIndentWidth: 4 126b1b8bc3fSopenharmony_ci# 在ObjC的@property后添加一个空格 127b1b8bc3fSopenharmony_ciObjCSpaceAfterProperty: false 128b1b8bc3fSopenharmony_ci# 在ObjC的protocol列表前添加一个空格 129b1b8bc3fSopenharmony_ciObjCSpaceBeforeProtocolList: true 130b1b8bc3fSopenharmony_ci# 在call(后对函数调用换行的penalty 131b1b8bc3fSopenharmony_ciPenaltyBreakBeforeFirstCallParameter: 19 132b1b8bc3fSopenharmony_ci# 在一个注释中引入换行的penalty 133b1b8bc3fSopenharmony_ciPenaltyBreakComment: 300 134b1b8bc3fSopenharmony_ci# 第一次在<<前换行的penalty 135b1b8bc3fSopenharmony_ciPenaltyBreakFirstLessLess: 120 136b1b8bc3fSopenharmony_ci# 在一个字符串字面量中引入换行的penalty 137b1b8bc3fSopenharmony_ciPenaltyBreakString: 1000 138b1b8bc3fSopenharmony_ci# 对于每个在行字符数限制之外的字符的penalty 139b1b8bc3fSopenharmony_ciPenaltyExcessCharacter: 1000000 140b1b8bc3fSopenharmony_ci# 将函数的返回类型放到它自己的行的penalty 141b1b8bc3fSopenharmony_ciPenaltyReturnTypeOnItsOwnLine: 120 142b1b8bc3fSopenharmony_ci# 指针和引用的对齐: Left, Right, Middle 143b1b8bc3fSopenharmony_ciPointerAlignment: Right 144b1b8bc3fSopenharmony_ci# 允许重新排版注释 145b1b8bc3fSopenharmony_ciReflowComments: true 146b1b8bc3fSopenharmony_ci# 允许排序#include 147b1b8bc3fSopenharmony_ci#SortIncludes: Never 148b1b8bc3fSopenharmony_ci# 在C风格类型转换后添加空格 149b1b8bc3fSopenharmony_ciSpaceAfterCStyleCast: false 150b1b8bc3fSopenharmony_ci# 在赋值运算符之前添加空格 151b1b8bc3fSopenharmony_ciSpaceBeforeAssignmentOperators: true 152b1b8bc3fSopenharmony_ci# 开圆括号之前添加一个空格: Never, ControlStatements, Always 153b1b8bc3fSopenharmony_ciSpaceBeforeParens: ControlStatements 154b1b8bc3fSopenharmony_ci# 在空的圆括号中添加空格 155b1b8bc3fSopenharmony_ciSpaceInEmptyParentheses: false 156b1b8bc3fSopenharmony_ci# 在尾随的评论前添加的空格数(只适用于//) 157b1b8bc3fSopenharmony_ciSpacesBeforeTrailingComments: 1 158b1b8bc3fSopenharmony_ci# 在尖括号的<后和>前添加空格 159b1b8bc3fSopenharmony_ciSpacesInAngles: false 160b1b8bc3fSopenharmony_ci# 在容器(ObjC和JavaScript的数组和字典等)字面量中添加空格 161b1b8bc3fSopenharmony_ciSpacesInContainerLiterals: true 162b1b8bc3fSopenharmony_ci# 在C风格类型转换的括号中添加空格 163b1b8bc3fSopenharmony_ciSpacesInCStyleCastParentheses: false 164b1b8bc3fSopenharmony_ci# 在圆括号的(后和)前添加空格 165b1b8bc3fSopenharmony_ciSpacesInParentheses: false 166b1b8bc3fSopenharmony_ci# 在方括号的[后和]前添加空格,lamda表达式和未指明大小的数组的声明不受影响 167b1b8bc3fSopenharmony_ciSpacesInSquareBrackets: false 168b1b8bc3fSopenharmony_ci# 标准: Cpp03, Cpp11, Auto 169b1b8bc3fSopenharmony_ciStandard: Cpp11 170b1b8bc3fSopenharmony_ci# tab宽度 171b1b8bc3fSopenharmony_ciTabWidth: 4 172b1b8bc3fSopenharmony_ci# 使用tab字符: Never, ForIndentation, ForContinuationAndIndentation, Always 173b1b8bc3fSopenharmony_ciUseTab: Never