#### 参考网址:https://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle : Microsoft
# 支持的语言
# None, Cpp, CSharp, Java, JaveScript, Json, Objc, Proto, TableGen, TextProto
Language : Cpp
# 支持的c++标准:c++03, c++11, c++14, c++17, c++20, Latest, Auto
Standard : c++11
# table 缩进大小
IndentWidth : 4
TabWidth : 4
UseTab : ForIndentation
# 换行使用\r\n
UseCRLF : true
AlignAfterOpenBracket : Align
AlignArrayOfStructures : Left
AlignConsecutiveAssignments : Consecutive
AlignConsecutiveBitFields : Consecutive
AlignConsecutiveDeclarations : false
AlignConsecutiveMacros : Consecutive
AlignEscapedNewlines : Left
AlignOperands : Align
AlignTrailingComments : true
AllowAllArgumentsOnNextLine : false
AllowAllParametersOfDeclarationOnNextLine : false
AllowShortBlocksOnASingleLine : Empty
AllowShortCaseLabelsOnASingleLine : true
AllowShortEnumsOnASingleLine : true
AllowShortFunctionsOnASingleLine : Empty
AllowShortIfStatementsOnASingleLine : Never
AllowShortLambdasOnASingleLine : Empty
AllowShortLoopsOnASingleLine : false
AlwaysBreakAfterReturnType : None
AlwaysBreakBeforeMultilineStrings : false
AlwaysBreakTemplateDeclarations : Yes
BinPackArguments : false
BinPackParameters : false
BitFieldColonSpacing : Both
BreakBeforeBraces: Custom
BraceWrapping :
AfterCaseLabel : false
AfterClass : true
AfterControlStatement : Never
AfterEnum: false
AfterFunction : true
AfterNamespace : false
AfterStruct: false
AfterUnion : false
AfterExternBlock : true
BeforeCatch : true
BeforeElse : true
BeforeLambdaBody : false
BeforeWhile : false
SplitEmptyFunction: false
SplitEmptyRecord : false
SplitEmptyNamespace : false
BreakBeforeBinaryOperators : None
BreakBeforeTernaryOperators : false
BreakStringLiterals : true
ColumnLimit : 80
ContinuationIndentWidth : 4
EmptyLineAfterAccessModifier : Leave
EmptyLineBeforeAccessModifier : LogicalBlock
# ForEachMacros: ['RANGES_FOR', 'FOREACH', 'BOOST_FOREACH']
# IfMacros: ['IF']
IncludeBlocks : Regroup
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 2
CaseSensitive: true
- Regex: '^((<|")(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '<[[:alnum:].]+>'
Priority: 4
- Regex: '.*'
Priority: 1
SortPriority: 0
IndentAccessModifiers : true
IndentCaseBlocks : true
IndentCaseLabels : false
IndentGotoLabels : true
IndentPPDirectives : BeforeHash
IndentWrappedFunctionNames : true
KeepEmptyLinesAtTheStartOfBlocks : false
# # MacroBlockBegin: "^NS_MAP_BEGIN|\
# # NS_TABLE_HEAD$"
# # MacroBlockEnd: "^\
# # NS_MAP_END|\
# # NS_TABLE_.*_END$"
PenaltyBreakAssignment : 1
PenaltyBreakBeforeFirstCallParameter : 1
PenaltyBreakComment : 1
PenaltyBreakFirstLessLess : 1
PenaltyBreakOpenParenthesis : 1
PenaltyBreakString : 0
PenaltyBreakTemplateDeclaration : 1
PenaltyExcessCharacter : 0
PenaltyIndentedWhitespace : 4
PenaltyReturnTypeOnItsOwnLine : 1
PointerAlignment : Left
# # RawStringFormats:
# # - Language: TextProto
# # Delimiters:
# # - 'pb'
# # - 'proto'
# # EnclosingFunctions:
# # - 'PARSE_TEXT_PROTO'
# # BasedOnStyle: google
# # - Language: Cpp
# # Delimiters:
# # - 'cc'
# # - 'cpp'
# # BasedOnStyle: llvm
# # CanonicalDelimiter: 'cc'
ReflowComments : true
SpaceAfterCStyleCast : false
SpaceAfterLogicalNot : false
SpaceAroundPointerQualifiers : Default
SpaceBeforeAssignmentOperators : true
SpaceBeforeCaseColon : false
SpaceBeforeSquareBrackets : false
SpaceInEmptyBlock : false
SpaceInEmptyParentheses : false
SpacesBeforeTrailingComments : 4
SpacesInCStyleCastParentheses : false
SpacesInContainerLiterals : false
生成后的效果如下所示
/**
* @file exercise_4.c
* @brief
* @author
* @version 0.0.1
* @date 2021-11-20
*
* @copyright Copyright (c) 2021
*
* @par 修改日志
* <table>
* <tr><th>Date <th>Version <th>Author <th>Description
* <tr><td>2021-11-20 <td>0.0.1 <td> <td>首版程序
* </table>
*/
#include "common_yaq.h" //!< 表示先从项目所在位置查找,找不到在从系统指定位置查找
#include <ctype.h>
#include <math.h> //!< 表示从系统指定位置查找
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void test_0(void)
{
for (uint8_t i = 0; i < 10; i++) {
printf("%d ", i);
}
while (FALSE) {
int formak; // test
}
printf("\r\n");
}
void test_1(void) {}
void test_2(void) {}
void test_3(void) {}
void test_4(void) {}
void test_5(void) {}
void test_6(void) {}
int32_t main(int32_t argc, char* argv[])
{
test_0();
/* 第一 */
// test_1();
//第二
// printf("======== 2 =========\r\n");
// test_2();
/* 第三 */
// printf("======== 3 =========\r\n");
// test_3();
/* 第四 */
// printf("======== 4 =========\r\n");
// test_4();
/* 第五 */
// printf("======== 5 =========\r\n");
// test_5();
/* 第六 */
// printf("======== 6 =========\r\n");
// test_6();
return 0;
}
但是table键的缩进明明设置为4了,但实际上还是2,还不清楚什么原因,先保存再次,方便以后在使用