🔧 chore(cpp): trim clang-format to intentional google deviations
- keep only the options that differ from Google style, each annotated with the Google default, so every override carries its own rationale - switch to Allman braces and a 120 column limit; short functions now collapse only when declared inline - dropped overrides fall back to Google behaviour, which turns include sorting, argument binpacking, comment reflow and namespace comment fixing back on - drop a stray trailing blank line in .clangd
This commit is contained in:
@@ -2,46 +2,10 @@
|
|||||||
Language: Cpp
|
Language: Cpp
|
||||||
BasedOnStyle: Google
|
BasedOnStyle: Google
|
||||||
|
|
||||||
# Keep consistent with the repo-wide 100 char guidance (adjust per-project if needed).
|
# --- intentional deviations from Google C++ defaults ---
|
||||||
ColumnLimit: 100
|
ColumnLimit: 120 # Google: 80
|
||||||
IndentWidth: 4
|
IndentWidth: 4 # Google: 2
|
||||||
|
TabWidth: 4 # Google/LLVM: 8(UseTab: Never 时几乎无感,与缩进对齐)
|
||||||
AccessModifierOffset: -4
|
AccessModifierOffset: -4 # Google: -1(配合 IndentWidth 4,使 public/private 与 class 同级)
|
||||||
AlignEscapedNewlines: Left
|
BreakBeforeBraces: Allman # Google: Attach
|
||||||
AlignTrailingComments: false
|
AllowShortFunctionsOnASingleLine: Inline # 需要显示Inline
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
|
||||||
AllowShortFunctionsOnASingleLine: All
|
|
||||||
AlwaysBreakTemplateDeclarations: Yes
|
|
||||||
BinPackArguments: false
|
|
||||||
BinPackParameters: false
|
|
||||||
BraceWrapping:
|
|
||||||
AfterCaseLabel: true
|
|
||||||
AfterUnion: true
|
|
||||||
AfterExternBlock: false
|
|
||||||
BreakBeforeTernaryOperators: false
|
|
||||||
BreakConstructorInitializers: AfterColon
|
|
||||||
BreakInheritanceList: AfterColon
|
|
||||||
CommentPragmas: "suppress"
|
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
|
||||||
Cpp11BracedListStyle: false
|
|
||||||
FixNamespaceComments: false
|
|
||||||
IncludeBlocks: Regroup
|
|
||||||
IncludeCategories:
|
|
||||||
- Regex: '^.*(precomp|pch|stdafx)'
|
|
||||||
Priority: -1
|
|
||||||
- Regex: '^".*"'
|
|
||||||
Priority: 1
|
|
||||||
- Regex: '^<.*>'
|
|
||||||
Priority: 2
|
|
||||||
- Regex: '.*'
|
|
||||||
Priority: 3
|
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
|
||||||
MacroBlockBegin: "BEGIN_TEST_METHOD_PROPERTIES|BEGIN_MODULE|BEGIN_TEST_CLASS|BEGIN_TEST_METHOD"
|
|
||||||
MacroBlockEnd: "END_TEST_METHOD_PROPERTIES|END_MODULE|END_TEST_CLASS|END_TEST_METHOD"
|
|
||||||
NamespaceIndentation: None
|
|
||||||
PointerAlignment: Left
|
|
||||||
ReflowComments: false
|
|
||||||
SortIncludes: false
|
|
||||||
SpaceAfterTemplateKeyword: false
|
|
||||||
SpacesInAngles: false
|
|
||||||
SpacesInContainerLiterals: false
|
|
||||||
|
|||||||
@@ -22,4 +22,3 @@ CompileFlags:
|
|||||||
Add:
|
Add:
|
||||||
- "-std=c17"
|
- "-std=c17"
|
||||||
Compiler: clang
|
Compiler: clang
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user