标签:
英文
Configuring Style in Code When using clang::format::reformat(...) functions, the format is specified by supplying the clang::format::FormatStyle structure. Configurable Format Style Options This section lists the supported style options. Value type is specified for each option. For enumeration types possible values are specified both as a C++ enumeration member (with a prefix, e.g. LS_Auto), and as a value usable in the configuration (without a prefix: Auto). BasedOnStyle (string) The style used for all options not specifically set in the configuration. This option is supported only in the clang-format configuration (both within -style=‘{...}‘ and the .clang-format file). Possible values: LLVM A style complying with the LLVM coding standards Google A style complying with Google’s C++ style guide Chromium A style complying with Chromium’s style guide Mozilla A style complying with Mozilla’s style guide WebKit A style complying with WebKit’s style guide AccessModifierOffset (int) The extra indent or outdent of access modifiers, e.g. public:. AlignAfterOpenBracket (BracketAlignmentStyle) If true, horizontally aligns arguments after an open bracket. This applies to round brackets (parentheses), angle brackets and square brackets. Possible values: BAS_Align (in configuration: Align) Align parameters on the open bracket, e.g.: someLongFunction(argument1, argument2); BAS_DontAlign (in configuration: DontAlign) Don’t align, instead use ContinuationIndentWidth, e.g.: someLongFunction(argument1, argument2); BAS_AlwaysBreak (in configuration: AlwaysBreak) Always break after an open bracket, if the parameters don’t fit on a single line, e.g.: someLongFunction( argument1, argument2); AlignConsecutiveAssignments (bool) If true, aligns consecutive assignments. This will align the assignment operators of consecutive lines. This will result in formattings like int aaaa = 12; int b = 23; int ccc = 23; AlignConsecutiveDeclarations (bool) If true, aligns consecutive declarations. This will align the declaration names of consecutive lines. This will result in formattings like int aaaa = 12; float b = 23; std::string ccc = 23; AlignEscapedNewlinesLeft (bool) If true, aligns escaped newlines as far left as possible. Otherwise puts them into the right-most column. AlignOperands (bool) If true, horizontally align operands of binary and ternary expressions. Specifically, this aligns operands of a single expression that needs to be split over multiple lines, e.g.: int aaa = bbbbbbbbbbbbbbb + ccccccccccccccc; AlignTrailingComments (bool) If true, aligns trailing comments. AllowAllParametersOfDeclarationOnNextLine (bool) Allow putting all parameters of a function declaration onto the next line even if BinPackParameters is false. AllowShortBlocksOnASingleLine (bool) Allows contracting simple braced statements to a single line. E.g., this allows if (a) { return; } to be put on a single line. AllowShortCaseLabelsOnASingleLine (bool) If true, short case labels will be contracted to a single line. AllowShortFunctionsOnASingleLine (ShortFunctionStyle) Dependent on the value, int f() { return 0; } can be put on a single line. Possible values: SFS_None (in configuration: None) Never merge functions into a single line. SFS_Empty (in configuration: Empty) Only merge empty functions. SFS_Inline (in configuration: Inline) Only merge functions defined inside a class. Implies “empty”. SFS_All (in configuration: All) Merge all functions fitting on a single line. AllowShortIfStatementsOnASingleLine (bool) If true, if (a) return; can be put on a single line. AllowShortLoopsOnASingleLine (bool) If true, while (true) continue; can be put on a single line. AlwaysBreakAfterDefinitionReturnType (DefinitionReturnTypeBreakingStyle) The function definition return type breaking style to use. This option is deprecated and is retained for backwards compatibility. Possible values: DRTBS_None (in configuration: None) Break after return type automatically. PenaltyReturnTypeOnItsOwnLine is taken into account. DRTBS_All (in configuration: All) Always break after the return type. DRTBS_TopLevel (in configuration: TopLevel) Always break after the return types of top-level functions. AlwaysBreakAfterReturnType (ReturnTypeBreakingStyle) The function declaration return type breaking style to use. Possible values: RTBS_None (in configuration: None) Break after return type automatically. PenaltyReturnTypeOnItsOwnLine is taken into account. RTBS_All (in configuration: All) Always break after the return type. RTBS_TopLevel (in configuration: TopLevel) Always break after the return types of top-level functions. RTBS_AllDefinitions (in configuration: AllDefinitions) Always break after the return type of function definitions. RTBS_TopLevelDefinitions (in configuration: TopLevelDefinitions) Always break after the return type of top-level definitions. AlwaysBreakBeforeMultilineStrings (bool) If true, always break before multiline string literals. This flag is mean to make cases where there are multiple multiline strings in a file look more consistent. Thus, it will only take effect if wrapping the string at that point leads to it being indented ContinuationIndentWidth spaces from the start of the line. AlwaysBreakTemplateDeclarations (bool) If true, always break after the template<...> of a template declaration. BinPackArguments (bool) If false, a function call’s arguments will either be all on the same line or will have one line each. BinPackParameters (bool) If false, a function declaration’s or function definition’s parameters will either all be on the same line or will have one line each. BraceWrapping (BraceWrappingFlags) Control of individual brace wrapping cases. If BreakBeforeBraces is set to BS_Custom, use this to specify how each individual brace case should be handled. Otherwise, this is ignored. Nested configuration flags: bool AfterClass Wrap class definitions. bool AfterControlStatement Wrap control statements (if/for/while/switch/..). bool AfterEnum Wrap enum definitions. bool AfterFunction Wrap function definitions. bool AfterNamespace Wrap namespace definitions. bool AfterObjCDeclaration Wrap ObjC definitions (@autoreleasepool, interfaces, ..). bool AfterStruct Wrap struct definitions. bool AfterUnion Wrap union definitions. bool BeforeCatch Wrap before catch. bool BeforeElse Wrap before else. bool IndentBraces Indent the wrapped braces themselves. BreakAfterJavaFieldAnnotations (bool) Break after each annotation on a field in Java files. BreakBeforeBinaryOperators (BinaryOperatorStyle) The way to wrap binary operators. Possible values: BOS_None (in configuration: None) Break after operators. BOS_NonAssignment (in configuration: NonAssignment) Break before operators that aren’t assignments. BOS_All (in configuration: All) Break before operators. BreakBeforeBraces (BraceBreakingStyle) The brace breaking style to use. Possible values: BS_Attach (in configuration: Attach) Always attach braces to surrounding context. BS_Linux (in configuration: Linux) Like Attach, but break before braces on function, namespace and class definitions. BS_Mozilla (in configuration: Mozilla) Like Attach, but break before braces on enum, function, and record definitions. BS_Stroustrup (in configuration: Stroustrup) Like Attach, but break before function definitions, catch, and else. BS_Allman (in configuration: Allman) Always break before braces. BS_GNU (in configuration: GNU) Always break before braces and add an extra level of indentation to braces of control statements, not to those of class, function or other definitions. BS_WebKit (in configuration: WebKit) Like Attach, but break before functions. BS_Custom (in configuration: Custom) Configure each individual brace in BraceWrapping. BreakBeforeTernaryOperators (bool) If true, ternary operators will be placed after line breaks. BreakConstructorInitializersBeforeComma (bool) Always break constructor initializers before commas and align the commas with the colon. BreakStringLiterals (bool) Allow breaking string literals when formatting. ColumnLimit (unsigned) The column limit. A column limit of 0 means that there is no column limit. In this case, clang-format will respect the input’s line breaking decisions within statements unless they contradict other rules. CommentPragmas (std::string) A regular expression that describes comments with special meaning, which should not be split into lines or otherwise changed. ConstructorInitializerAllOnOneLineOrOnePerLine (bool) If the constructor initializers don’t fit on a line, put each initializer on its own line. ConstructorInitializerIndentWidth (unsigned) The number of characters to use for indentation of constructor initializer lists. ContinuationIndentWidth (unsigned) Indent width for line continuations. Cpp11BracedListStyle (bool) If true, format braced lists as best suited for C++11 braced lists. Important differences: - No spaces inside the braced list. - No line break before the closing brace. - Indentation with the continuation indent, not with the block indent. Fundamentally, C++11 braced lists are formatted exactly like function calls would be formatted in their place. If the braced list follows a name (e.g. a type or variable name), clang-format formats as if the {} were the parentheses of a function call with that name. If there is no name, a zero-length name is assumed. DerivePointerAlignment (bool) If true, analyze the formatted file for the most common alignment of & and \*. PointerAlignment is then used only as fallback. DisableFormat (bool) Disables formatting completely. ExperimentalAutoDetectBinPacking (bool) If true, clang-format detects whether function calls and definitions are formatted with one parameter per line. Each call can be bin-packed, one-per-line or inconclusive. If it is inconclusive, e.g. completely on one line, but a decision needs to be made, clang-format analyzes whether there are other bin-packed cases in the input file and act accordingly. NOTE: This is an experimental flag, that might go away or be renamed. Do not use this in config files, etc. Use at your own risk. ForEachMacros (std::vector<std::string>) A vector of macros that should be interpreted as foreach loops instead of as function calls. These are expected to be macros of the form: FOREACH(<variable-declaration>, ...) <loop-body> In the .clang-format configuration file, this can be configured like: ForEachMacros: [‘RANGES_FOR‘, ‘FOREACH‘] For example: BOOST_FOREACH. IncludeCategories (std::vector<IncludeCategory>) Regular expressions denoting the different #include categories used for ordering #includes. These regular expressions are matched against the filename of an include (including the <> or “”) in order. The value belonging to the first matching regular expression is assigned and #includes are sorted first according to increasing category number and then alphabetically within each category. If none of the regular expressions match, INT_MAX is assigned as category. The main header for a source file automatically gets category 0. so that it is generally kept at the beginning of the #includes (http://llvm.org/docs/CodingStandards.html#include-style). However, you can also assign negative priorities if you have certain headers that always need to be first. To configure this in the .clang-format file, use: IncludeCategories: - Regex: ‘^"(llvm|llvm-c|clang|clang-c)/‘ Priority: 2 - Regex: ‘^(<|"(gtest|isl|json)/)‘ Priority: 3 - Regex: ‘.\*‘ Priority: 1 IncludeIsMainRegex (std::string) Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping. When guessing whether a #include is the “main” include (to assign category 0, see above), use this regex of allowed suffixes to the header stem. A partial match is done, so that: - “” means “arbitrary suffix” - “$” means “no suffix” For example, if configured to “(_test)?$”, then a header a.h would be seen as the “main” include in both a.cc and a_test.cc. IndentCaseLabels (bool) Indent case labels one level from the switch statement. When false, use the same indentation level as for the switch statement. Switch statement body is always indented one level more than case labels. IndentWidth (unsigned) The number of columns to use for indentation. IndentWrappedFunctionNames (bool) Indent if a function definition or declaration is wrapped after the type. JavaScriptQuotes (JavaScriptQuoteStyle) The JavaScriptQuoteStyle to use for JavaScript strings. Possible values: JSQS_Leave (in configuration: Leave) Leave string quotes as they are. JSQS_Single (in configuration: Single) Always use single quotes. JSQS_Double (in configuration: Double) Always use double quotes. KeepEmptyLinesAtTheStartOfBlocks (bool) If true, empty lines at the start of blocks are kept. Language (LanguageKind) Language, this format style is targeted at. Possible values: LK_None (in configuration: None) Do not use. LK_Cpp (in configuration: Cpp) Should be used for C, C++, ObjectiveC, ObjectiveC++. LK_Java (in configuration: Java) Should be used for Java. LK_JavaScript (in configuration: JavaScript) Should be used for JavaScript. LK_Proto (in configuration: Proto) Should be used for Protocol Buffers (https://developers.google.com/protocol-buffers/). LK_TableGen (in configuration: TableGen) Should be used for TableGen code. MacroBlockBegin (std::string) A regular expression matching macros that start a block. MacroBlockEnd (std::string) A regular expression matching macros that end a block. MaxEmptyLinesToKeep (unsigned) The maximum number of consecutive empty lines to keep. NamespaceIndentation (NamespaceIndentationKind) The indentation used for namespaces. Possible values: NI_None (in configuration: None) Don’t indent in namespaces. NI_Inner (in configuration: Inner) Indent only in inner namespaces (nested in other namespaces). NI_All (in configuration: All) Indent in all namespaces. ObjCBlockIndentWidth (unsigned) The number of characters to use for indentation of ObjC blocks. ObjCSpaceAfterProperty (bool) Add a space after @property in Objective-C, i.e. use @property (readonly) instead of @property(readonly). ObjCSpaceBeforeProtocolList (bool) Add a space in front of an Objective-C protocol list, i.e. use Foo <Protocol> instead of Foo<Protocol>. PenaltyBreakBeforeFirstCallParameter (unsigned) The penalty for breaking a function call after call(. PenaltyBreakComment (unsigned) The penalty for each line break introduced inside a comment. PenaltyBreakFirstLessLess (unsigned) The penalty for breaking before the first <<. PenaltyBreakString (unsigned) The penalty for each line break introduced inside a string literal. PenaltyExcessCharacter (unsigned) The penalty for each character outside of the column limit. PenaltyReturnTypeOnItsOwnLine (unsigned) Penalty for putting the return type of a function onto its own line. PointerAlignment (PointerAlignmentStyle) Pointer and reference alignment style. Possible values: PAS_Left (in configuration: Left) Align pointer to the left. PAS_Right (in configuration: Right) Align pointer to the right. PAS_Middle (in configuration: Middle) Align pointer in the middle. ReflowComments (bool) If true, clang-format will attempt to re-flow comments. SortIncludes (bool) If true, clang-format will sort #includes. SpaceAfterCStyleCast (bool) If true, a space may be inserted after C style casts. SpaceAfterTemplateKeyword (bool) If true, a space will be inserted after the ‘template’ keyword. SpaceBeforeAssignmentOperators (bool) If false, spaces will be removed before assignment operators. SpaceBeforeParens (SpaceBeforeParensOptions) Defines in which cases to put a space before opening parentheses. Possible values: SBPO_Never (in configuration: Never) Never put a space before opening parentheses. SBPO_ControlStatements (in configuration: ControlStatements) Put a space before opening parentheses only after control statement keywords (for/if/while...). SBPO_Always (in configuration: Always) Always put a space before opening parentheses, except when it’s prohibited by the syntax rules (in function-like macro definitions) or when determined by other style rules (after unary operators, opening parentheses, etc.) SpaceInEmptyParentheses (bool) If true, spaces may be inserted into (). SpacesBeforeTrailingComments (unsigned) The number of spaces before trailing line comments (// - comments). This does not affect trailing block comments (/* - comments) as those commonly have different usage patterns and a number of special cases. SpacesInAngles (bool) If true, spaces will be inserted after < and before > in template argument lists. SpacesInCStyleCastParentheses (bool) If true, spaces may be inserted into C style casts. SpacesInContainerLiterals (bool) If true, spaces are inserted inside container literals (e.g. ObjC and Javascript array and dict literals). SpacesInParentheses (bool) If true, spaces will be inserted after ( and before ). SpacesInSquareBrackets (bool) If true, spaces will be inserted after [ and before ]. Standard (LanguageStandard) Format compatible with this standard, e.g. use A<A<int> > instead of A<A<int>> for LS_Cpp03. Possible values: LS_Cpp03 (in configuration: Cpp03) Use C++03-compatible syntax. LS_Cpp11 (in configuration: Cpp11) Use features of C++11 (e.g. A<A<int>> instead of A<A<int> >). LS_Auto (in configuration: Auto) Automatic detection based on the input. TabWidth (unsigned) The number of columns used for tab stops. UseTab (UseTabStyle) The way to use tab characters in the resulting file. Possible values: UT_Never (in configuration: Never) Never use tab. UT_ForIndentation (in configuration: ForIndentation) Use tabs only for indentation. UT_Always (in configuration: Always) Use tabs whenever we need to fill whitespace that spans at least from one tab stop to the next one. Adding additional style options Each additional style option adds costs to the clang-format project. Some of these costs affect the clang-format development itself, as we need to make sure that any given combination of options work and that new features don’t break any of the existing options in any way. There are also costs for end users as options become less discoverable and people have to think about and make a decision on options they don’t really care about. The goal of the clang-format project is more on the side of supporting a limited set of styles really well as opposed to supporting every single style used by a codebase somewhere in the wild. Of course, we do want to support all major projects and thus have established the following bar for adding style options. Each new style option must .. be used in a project of significant size (have dozens of contributors) have a publicly accessible style guide have a person willing to contribute and maintain patches
中文
在代码中配置样式 当使用铿锵::格式::格式化(…)的功能,格式提供铿锵指定::格式::formatstyle结构。 可配置格式选项 本节列出了支持的样式选项。值类型为每个选项指定。枚举类型的可能值被指定作为一个C++枚举成员(有一个前缀,例如ls_auto),并作为一种价值在配置使用(没有前缀:汽车)。 basedonstyle(字符串) 用于所有不在配置中特别设置的选项的样式。 此选项仅在铿锵的格式支持的配置(在风格=“{…}”的。铿锵格式文件)。 可能的值: LLVM的风格符合LLVM的编码标准 一种风格符合谷歌的C++风格指南谷歌 一种符合铬风格指南的风格 Mozilla的风格符合Mozilla的风格指南 WebKit的风格符合WebKit的风格指南 accessmodifieroffset(int) 访问修饰符的额外的升级或降级,如公共:。 AlignAfterOpenBracket(bracketalignmentstyle) 如果真的,打开支架后水平对齐参数。 适用于圆括号(括号),角括号和方括号。 可能的值: bas_align(配置:对齐)对齐参数对开放的括号,如: somelongfunction(论证1, 论证2); bas_dontalign(配置:dontalign)不对齐,而用continuationindentwidth,例如: somelongfunction(论证1, 论证2); bas_alwaysbreak(配置:alwaysbreak)打破后总是一个开放的括号,如果参数不适合在一个单一的线,如: somelongfunction( 论证1,论证2); alignconsecutiveassignments(布尔) 如果是真的,对齐连续的赋值。 这将使连续行的赋值操作符。这将导致在格式化一样 国际AAAA级= 12; b = 23; int CCC = 23; alignconsecutivedeclarations(布尔) 如果是真的,对齐连续的声明。 这将使连续行的声明名称对齐。这将导致在格式化一样 国际AAAA级= 12; 浮动B = 23; std::string CCC = 23; AlignEscapedNewlinesLeft(布尔) 如果属实,将逃跑的换行尽量远抛。否则放在最右边的列。 alignoperands(布尔) 如果真的,水平对齐的二进制和三元表达式的操作数。 具体来说,这将一个表达式的操作数,一个需要被分裂的多行,例如: int AAA = bbbbbbbbbbbbbbb + ccccccccccccccc; aligntrailingcomments(布尔) 如果是真的,对齐尾随的评论。 allowallparametersofdeclarationonnextline(布尔) 允许将一个函数声明的所有参数到线下即使BinPackParameters是假的。 allowshortblocksonasingleline(布尔) 允许将简单的支撑语句承包给一个单行线。 例如,这允许如果(a){返回;}将被放置在一个行。 allowshortcaselabelsonasingleline(布尔) 如果是真的,短的情况下标签将被收缩到一个单一的线。 allowshortfunctionsonasingleline(shortfunctionstyle) 依赖的价值,诠释f() { return 0;}可以放在一行。 可能的值: sfs_none(配置:无)从来没有合并成一个单一的线功能。 sfs_empty(配置:空)只有合并空函数。 sfs_inline(配置:内联)类中定义的函数只能合并。意味着“空”。 sfs_all(配置:所有)合并在一行中的所有函数拟合。 allowshortifstatementsonasingleline(布尔) 如果是真的,如果(a)返回,可以放在一个单行线。 allowshortloopsonasingleline(布尔) 如果是真的,而(真)继续下去,可以放在一个单行线。 AlwaysBreakAfterDefinitionReturnType(definitionreturntypebreakingstyle) 功能定义返回式打破风格使用。这个选项是过时的和被保留的向后兼容性。 可能的值: drtbs_none(配置:无)休息后返回类型自动。penaltyreturntypeonitsownline考虑。 drtbs_all(配置:所有)打破后总是返回类型。 drtbs_toplevel(配置:顶层)破裂后顶层函数的返回类型总是。 AlwaysBreakAfterReturnType(returntypebreakingstyle) 功能声明返回式打破风格使用。 可能的值: rtbs_none(配置:无)休息后返回类型自动。penaltyreturntypeonitsownline考虑。 rtbs_all(配置:所有)打破后总是返回类型。 rtbs_toplevel(配置:顶层)破裂后顶层函数的返回类型总是。 rtbs_alldefinitions(配置:alldefinitions)打破函数定义返回类型后总是。 rtbs_topleveldefinitions(配置:topleveldefinitions)打破顶层定义返回类型后总是。 AlwaysBreakBeforeMultilineStrings(布尔) 如果是真的,总是打破以往多行字符串。 这个标志意味着使情况有多行字符串在文件看起来更一致。因此,只有缠绕在这一点上串导致它被缩进continuationindentwidth空间从线开始生效。 alwaysbreaktemplatedeclarations(布尔) 如果是真的,总是在模板声明的模板<…>之后中断。 binpackarguments(布尔) 如果是错误的,函数调用的参数将在同一行上,或将有一行一行。 BinPackParameters(布尔) 如果是错误的,函数声明的或函数定义的参数将都在同一行上,或将有一行一行。 bracewrapping(bracewrappingflags) 个人支撑包装箱的控制。 如果breakbeforebraces设置bs_custom,使用指定每个支撑情况应如何处理。否则,这是被忽略的。 嵌套配置标志: 布尔课外包类的定义。 布尔aftercontrolstatement包控制语句(如果/ /而/开关/ ..)。 布尔afterenum包枚举定义。 布尔afterfunction包函数定义。 布尔afternamespace包的命名空间定义。 布尔afterobjcdeclaration包objc定义(@ autoreleasepool,接口,..)。 布尔afterstruct包的结构定义。 布尔afterunion包装联盟的定义。 布尔beforecatch包装前赶。 布尔beforeelse前把别的。 布尔indentbraces缩进包裹支撑自己。 breakafterjavafieldannotations(布尔) 在java文件的每个注释后打破场。 breakbeforebinaryoperators(binaryoperatorstyle) 包装二进制运算符的方法。 可能的值: bos_none(配置:无)休息后运营商。 bos_nonassignment(配置:nonassignment)之前,运营商不工作休息。 bos_all(配置:所有)打破以往运营商。 breakbeforebraces(bracebreakingstyle) 支撑打破风格使用。 可能的值: bs_attach(配置:高度)高度支撑环境。 bs_linux(配置:Linux)喜欢高度,但在支撑功能的突破,命名空间和类定义。 bs_mozilla(配置:Mozilla)像重视,但在支撑在枚举功能突破,并记录定义。 bs_stroustrup(配置:Stroustrup)喜欢高度,但突破前的函数定义,抓,和其他。 bs_allman(配置:奥尔曼)总是打破前支撑。 bs_gnu(配置:GNU)总是打破前括号加一个额外的水平缩进控制语句括号,不是那些的类、函数或其他定义。 bs_webkit(配置:WebKit)像重视突破前的功能,但。 bs_custom(配置:配置自定义)在BraceWrapping的每一个人撑。 breakbeforeternaryoperators(布尔) 如果是真的,三元运算符将被放置在断线后。 breakconstructorinitializersbeforecomma(布尔) 总是打破构造函数初始化式前逗号和逗号与冒号对齐。 breakstringliterals(布尔) 允许打破字符串格式化时。 ColumnLimit(签名) 列极限。 列的限制为0意味着没有列限制。在这种情况下,语音输入的格式将尊重断线决定在陈述除非与其他规则。 commentpragmas(std::string) 一个固定的表达式,它描述了具有特殊意义的注释,不应该被分裂成行或以其他方式改变。 constructorinitializerallononelineoroneperline(布尔) 如果构造函数初始化器不适合在一条线,把每个初始化自己的线。 constructorinitializerindentwidth(符号) 使用构造函数初始化列表缩进的字符数。 ContinuationIndentWidth(签名) 订单连续行的宽度。 cpp11bracedliststyle(布尔) 如果是真的,格式支撑列为最适合C++ 11支撑列表。 重要区别:-没有空格内的支撑列表。-关闭前的支架没有断开。与延续缩进缩进,不与块缩进。 从根本上讲,C++ 11支撑列表是一模一样的函数调用格式将在他们的地方格式化。如果支撑列表如下一个名字(例如类型或变量名),铿锵的格式格式,如果{ }是一个同名的函数调用的括号。如果没有名称,则假定一零个长度的名称。 derivepointeralignment(布尔) 如果是真的,分析最常见的对齐方式的格式化文件和/ *。pointeralignment则仅作为后备。 DisableFormat(布尔) 完全禁用格式化。 experimentalautodetectbinpacking(布尔) 如果是真的,铿锵的格式检测是否函数调用和定义格式每行一个参数。 每个电话都可以被包装,每行一个或不确定的。如果是不确定的,例如完全在一行,但需要做出一个决定,铿锵的格式分析是否有其他仓装病例的输入文件和相应的行动。 注意:这是一个实验标志,可能会消失或被重命名。不要使用这个在配置文件,等使用在你自己的风险。 foreachmacros(std::vector << std::string >) 一个宏,应解释为foreach循环而不是作为函数调用矢量。 这些都是预期的形式的宏: foreach(<变量声明>,…) <循环体> 在。铛格式的配置文件,这可以配置像: foreachmacros:[ ‘ranges_for ‘,‘一‘ ] 例如:boost_foreach。 includecategories(std::vector < includecategory >) 正则表达式表示的不同#包括用于订购#类别包括。 这些正则表达式与一个包含(包括< >或“)的文件的文件名相匹配。属于第一匹配正则表达式的值是分配和#包括排序首先根据增加类别数然后按字母顺序在每个类别。 如果正则表达式都不匹配,int_max分配类别。源文件的主头自动获取类别0。因此,它通常是保持在#开始包括(http:/ / LLVM。org /文档/编码规范,包括HTML #风格)。然而,如果你有一定的头,总是需要首先,你也可以分配负面的优先事项。 此配置在铿锵格式文件,使用: includecategories: -正则表达式:“^”(LLVM | llvm-c |铿锵| clang-c)/” 优先:2 -正则表达式:“^(< |”(gtest | ISL | JSON)/)” 优先:3 -正则表达式:‘。\” 优先:1 includeismainregex(std::string) 指定的后缀,可以在文件主要包括映射的正则表达式。 在猜测是否#包括是“主要”包括(指定类别0,见上文),这允许使用正则表达式后缀头干。部分匹配完成,所以说:-“”意思是“任意后缀”-“$”的意思是“没有后缀” 例如,如果设置为“(_test)?$”,然后一头一将被视为“主要”包括两a.cc和a_test.cc。 indentcaselabels(布尔) 缩进case标签一级从switch语句。 当错误时,使用相同的缩进级别作为切换语句。switch语句的身体总是缩进一级以上的case标签。 indentwidth(符号) 用于缩进的列数。 indentwrappedfunctionnames(布尔) 缩进如果函数定义或声明后包的类型。 JavaScriptQuotes(javascriptquotestyle) 的javascriptquotestyle使用JavaScript字符串。 可能的值: jsqs_leave(配置:把字符串引号)离开他们。 jsqs_single(配置:单)总是使用单引号。 jsqs_double(配置:双)总是使用双引号。 keepemptylinesatthestartofblocks(布尔) 如果是真的,则保持块开始时的空行。 语言(LanguageKind) 语言,这种格式的风格是针对。 可能的值: lk_none(配置:无)不使用。 lk_cpp(配置:CPP)应使用C、C++、ObjectiveC、ObjectiveC + +。 lk_java(配置:java)应该用于java。 lk_javascript(配置:JavaScript)应使用JavaScript。 lk_proto(配置:原)应使用protocol buffers(https:/ /开发商。谷歌。COM / protocol buffers /)。 lk_tablegen(配置:tablegen)应该用于tablegen代码。 MacroBlockBegin(std::string) 启动一个块的正则表达式匹配宏。 MacroBlockEnd(std::string) 正则表达式匹配的宏,结束一个块。 MaxEmptyLinesToKeep(签名) 保持连续的空行的最大数量。 namespaceindentation(NamespaceIndentationKind) 使用命名空间的压痕。 可能的值: ni_none(配置:无)不缩进的命名空间。 ni_inner(配置:内)缩进只有内部命名空间(嵌套在其他命名空间)。 ni_all(配置:所有)在所有命名空间缩进。 ObjCBlockIndentWidth(签名) 使用objc块缩进的字符数。 objcspaceafterproperty(布尔) 物业在Objective-C后添加空间”,即使用“属性(只读)而不是“属性(只读)。 objcspacebeforeprotocollist(布尔) 在一个协议和清单的前面添加一个空间,即使用foo <协议>代替foo <协议>。 PenaltyBreakBeforeFirstCallParameter(签名) 调用后的函数调用的惩罚(。 penaltybreakcomment(符号) 评论内的每一个行的惩罚。 penaltybreakfirstlessless(符号) 前一个<<分手的惩罚。 penaltybreakstring(符号) 字符串字面值中引入的每个行的惩罚。 PenaltyExcessCharacter(签名) 对列限制以外的每个字符的惩罚。 PenaltyReturnTypeOnItsOwnLine(签名) 将函数返回类型的函数放在自己的行上的惩罚。 pointeralignment(pointeralignmentstyle) 指针和参考对齐样式。 可能的值: pas_left(配置:左)对齐指针向左。 pas_right(配置:右)对齐指针向右。 pas_middle(配置:中间)对齐指针在中间。 reflowcomments(布尔) 如果是真的,铿锵的格式将尝试重新流动的评论。 sortincludes(布尔) 如果是真的话,会#铿锵格式包括。 spaceaftercstylecast(布尔) 如果是真的,空格可以在C样式的转换后插入。 SpaceAfterTemplateKeyword(布尔) 如果是真的,一个空格将被插入后的“模板”关键字。 spacebeforeassignmentoperators(布尔) 如果错误,空格将在赋值操作符之前被移除。 SpaceBeforeParens(spacebeforeparensoptions) 打开括号之前先定义空格的情况。 可能的值: sbpo_never(配置:永远不要把一个空间)在打开括号。 sbpo_controlstatements(配置:controlstatements)把一个空间之前开括号只有在控制语句关键字(/如果/当…)。 sbpo_always(配置:总是)总是把空间开放前的括号,除非它是由语法规则禁止(在类似函数的宏定义)或由其他样式规则(后一元运算符,开括号,等) SpaceInEmptyParentheses(布尔) 如果是真的,空格可以插入()。 spacesbeforetrailingcomments(符号) 尾随行注释(/ -注释)之前的空格数(/ -注释)。 这不影响后面的块注释(/ *评论),因为这些通常有不同的使用模式和一些特殊情况。 spacesinangles(布尔) 如果是真的,空格将在模板参数列表中的<和之前>之后被插入。 SpacesInCStyleCastParentheses(布尔) 如果是真的,空格可以插入C风格的转换。 SpacesInContainerLiterals(布尔) 如果是真的,空间是插入容器内的文字(例如objc和JavaScript数组和字典的文字)。 SpacesInParentheses(布尔) 如果是真的,空格将被插入(和以前)。 spacesinsquarebrackets(布尔) 如果是真的,空格将在[和之前]被插入。 标准(标准) 与这个标准相兼容的格式,例如使用<int > >不是一个<int > >为ls_cpp03。 可能的值: ls_cpp03(配置:cpp03)使用C++ 03兼容的语法。 ls_cpp11(配置:cpp11)C++ 11用的功能(例如int>><<不是一个int > >)。 ls_auto(配置:自动)基于输入的自动检测。 标签页的宽度(无符号) 用于制表位的列数。 UseTab(usetabstyle) 在生成的文件中使用制表符的方法。 可能的值: ut_never(配置:永远不要使用标签)。 ut_forindentation(配置:forindentation)使用制表符缩进只。 ut_always(配置:总是)使用的标签,每当我们需要填补的空白,至少从一个制表位到下一个。 添加额外的样式选项 每一个额外的样式选项增加了成本,铿锵格式项目。这些成本影响铛格式本身的发展,我们需要确保任何给定的选项组合工作和新功能,不违反任何现有的以任何方式选择。也有用户成本选项越来越发现和人们思考和选择他们真的不在乎做决定。 的语音格式项目目标更是站在支持有限的一组风格很好,相对于支持每个风格在野生的代码使用。当然,我们希望支持所有的主要项目,从而建立了以下栏添加样式选项。每一个新的样式选项必须。 用于重大规模的项目(有几十个贡献者) 有一个可公开访问的样式指南 有一个愿意贡献和维护补丁的人
标签:
原文地址:http://www.cnblogs.com/PaulpauL/p/5929753.html