Skip to content

Commit e7e0dac

Browse files
committed
Merge branch 'artyom-fedosov-improvement/formatting'
2 parents 1bac154 + 8d66827 commit e7e0dac

File tree

3 files changed

+105
-1
lines changed

3 files changed

+105
-1
lines changed

.clang-format

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Style tries to match doxygen's source code style (not perfect)
2+
3+
BasedOnStyle: LLVM
4+
5+
# Do not reflow lines or comments; keeps existing wrapping/spacing.
6+
ColumnLimit: 0
7+
ReflowComments: false
8+
9+
# Preserve include order and grouping exactly as written.
10+
SortIncludes: Never
11+
IncludeBlocks: Preserve
12+
SortUsingDeclarations: false
13+
14+
# Indentation
15+
UseTab: Never
16+
IndentWidth: 2
17+
ContinuationIndentWidth: 2
18+
NamespaceIndentation: None
19+
IndentPPDirectives: None
20+
IndentCaseLabels: false
21+
IndentGotoLabels: false
22+
IndentAccessModifiers : true
23+
24+
# Braces: Allman style (brace on next line for functions, classes, control).
25+
BreakBeforeBraces: Custom
26+
BraceWrapping:
27+
AfterCaseLabel: true
28+
AfterClass: true
29+
AfterControlStatement: true
30+
AfterEnum: true
31+
AfterFunction: true
32+
AfterNamespace: true
33+
AfterObjCDeclaration: true
34+
AfterStruct: true
35+
AfterUnion: true
36+
AfterExternBlock: true
37+
BeforeCatch: true
38+
BeforeElse: true
39+
BeforeLambdaBody: false
40+
BeforeWhile: false
41+
IndentBraces: false
42+
SplitEmptyFunction: true
43+
SplitEmptyRecord: true
44+
SplitEmptyNamespace: true
45+
46+
# Access specifiers are indented like members in the file.
47+
AccessModifierOffset: 0
48+
EmptyLineBeforeAccessModifier: Never
49+
50+
# Short things on one line are common (e.g., inline ctor bodies).
51+
AllowShortFunctionsOnASingleLine: All
52+
AllowShortIfStatementsOnASingleLine: true
53+
AllowShortLoopsOnASingleLine: true
54+
AllowShortCaseLabelsOnASingleLine: true
55+
AllowShortLambdasOnASingleLine: All
56+
AllowAllArgumentsOnNextLine: true
57+
AllowAllParametersOfDeclarationOnNextLine: true
58+
59+
# Initializer lists
60+
BreakConstructorInitializers: AfterColon
61+
AllowAllConstructorInitializersOnNextLine: true
62+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
63+
64+
# Spacing
65+
SpaceBeforeParens: ControlStatements
66+
SpacesInParentheses: false
67+
SpacesInSquareBrackets: false
68+
SpacesInAngles: false
69+
SpaceBeforeSquareBrackets: false
70+
SpaceAfterCStyleCast: false
71+
72+
# Pointer/reference binding matches code: `Type *name`, `Type &name`.
73+
DerivePointerAlignment: false
74+
PointerAlignment: Right
75+
ReferenceAlignment: Right
76+
77+
# Keep existing alignment/columns where possible.
78+
AlignTrailingComments: true
79+
AlignOperands: true
80+
AlignConsecutiveAssignments: AcrossEmptyLinesAndComments
81+
AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments
82+
AlignConsecutiveMacros: None
83+
AlignEscapedNewlines: DontAlign
84+
AlignAfterOpenBracket: Align
85+
BreakBeforeBinaryOperators: None
86+
87+
# Keep moderate vertical spacing, don't aggressively collapse empties.
88+
KeepEmptyLinesAtTheStartOfBlocks: true
89+
MaxEmptyLinesToKeep: 2
90+
91+
# Avoid changing braced-init formatting in ways that could churn.
92+
Cpp11BracedListStyle: false
93+
94+
# Avoid messing with some macros
95+
WhitespaceSensitiveMacros:
96+
- SRCLANGEXT
97+
- ML_TYPE
98+
- TSPEC0
99+
- TSPEC
100+
- ETYPE
101+

src/layout.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ static auto endCb(void (LayoutParser::*fn)(Args...))
787787
return [=](LayoutParser &parser,const std::string &id) { (parser.*fn)(id); };
788788
}
789789

790+
// clang-format off
790791
static const std::map< std::string, ElementCallbacks > g_elementHandlers =
791792
{
792793
// path/name
@@ -1351,6 +1352,7 @@ static const std::map< std::string, ElementCallbacks > g_elementHandlers =
13511352
{ "directory/memberdecl/dirs", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirSubDirs) } },
13521353
{ "directory/memberdecl/files", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirFiles) } },
13531354
};
1355+
// clang-format on
13541356

13551357
} // namespace
13561358

src/types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ class LocalToc
629629

630630
//---------------------------------------------------------------------------------------
631631

632-
632+
// clang-format off
633633
#define TYPE_SPECIFIERS \
634634
/* 0 */ TSPEC0(Template) TSPEC(Generic) TSPEC(Ref) TSPEC(Value) TSPEC(Interface) \
635635
/* 5 */ TSPEC(Struct) TSPEC(Union) TSPEC(Exception) TSPEC(Protocol) TSPEC(Category) \
@@ -645,6 +645,7 @@ class LocalToc
645645
/* 55 */ TSPEC(Readonly) TSPEC(Bound) TSPEC(Constrained) TSPEC(Transient) TSPEC(MaybeVoid) \
646646
/* 60 */ TSPEC(MaybeDefault) TSPEC(MaybeAmbiguous) TSPEC(Published) TSPEC(ConstEval) TSPEC(ConstInit) \
647647
/* 65 */ TSPEC(NoDiscard) TSPEC(ThreadLocal)
648+
// clang-format on
648649

649650
/** Wrapper class for a number of boolean properties.
650651
* The properties are packed together, and initialized to false.

0 commit comments

Comments
 (0)