Skip to content

Commit 0d73fdd

Browse files
authored
Reformat code (#7622)
1 parent f48fa55 commit 0d73fdd

File tree

132 files changed

+1206
-945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1206
-945
lines changed

.clang-format

+82-22
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
2-
# Don't try to format any languages not described by this file
3-
DisableFormat: true
4-
BasedOnStyle: LLVM
2+
Language: Cpp
53
AccessModifierOffset: -4
64
AlignAfterOpenBracket: Align
7-
AlignConsecutiveMacros: false
8-
AlignConsecutiveAssignments: false
9-
AlignConsecutiveDeclarations: false
5+
AlignArrayOfStructures: None
6+
AlignConsecutiveMacros: None
7+
AlignConsecutiveAssignments: None
8+
AlignConsecutiveBitFields: None
9+
AlignConsecutiveDeclarations: None
1010
AlignEscapedNewlines: Right
11-
AlignOperands: true
11+
AlignOperands: Align
1212
AlignTrailingComments: true
1313
AllowAllArgumentsOnNextLine: true
14-
AllowAllConstructorInitializersOnNextLine: true
1514
AllowAllParametersOfDeclarationOnNextLine: true
16-
AllowShortBlocksOnASingleLine: false
15+
AllowShortEnumsOnASingleLine: true
16+
AllowShortBlocksOnASingleLine: Never
1717
AllowShortCaseLabelsOnASingleLine: false
1818
AllowShortFunctionsOnASingleLine: Empty
1919
AllowShortLambdasOnASingleLine: Empty
@@ -23,12 +23,14 @@ AlwaysBreakAfterDefinitionReturnType: None
2323
AlwaysBreakAfterReturnType: None
2424
AlwaysBreakBeforeMultilineStrings: false
2525
AlwaysBreakTemplateDeclarations: Yes
26+
AttributeMacros:
27+
- __capability
2628
BinPackArguments: true
2729
BinPackParameters: true
2830
BraceWrapping:
2931
AfterCaseLabel: false
3032
AfterClass: false
31-
AfterControlStatement: false
33+
AfterControlStatement: Never
3234
AfterEnum: false
3335
AfterFunction: true
3436
AfterNamespace: false
@@ -38,27 +40,39 @@ BraceWrapping:
3840
AfterExternBlock: false
3941
BeforeCatch: true
4042
BeforeElse: true
43+
BeforeLambdaBody: false
44+
BeforeWhile: false
4145
IndentBraces: false
4246
SplitEmptyFunction: true
4347
SplitEmptyRecord: true
4448
SplitEmptyNamespace: true
4549
BreakBeforeBinaryOperators: None
50+
BreakBeforeConceptDeclarations: true
4651
BreakBeforeBraces: Custom
4752
BreakBeforeInheritanceComma: false
4853
BreakInheritanceList: BeforeColon
4954
BreakBeforeTernaryOperators: true
55+
BreakConstructorInitializersBeforeComma: false
5056
BreakConstructorInitializers: BeforeComma
5157
BreakAfterJavaFieldAnnotations: false
5258
BreakStringLiterals: true
5359
ColumnLimit: 118
5460
CommentPragmas: '^ IWYU pragma:'
61+
QualifierAlignment: Leave
5562
CompactNamespaces: false
56-
ConstructorInitializerAllOnOneLineOrOnePerLine: false
5763
ConstructorInitializerIndentWidth: 4
5864
ContinuationIndentWidth: 4
5965
Cpp11BracedListStyle: true
66+
DeriveLineEnding: true
6067
DerivePointerAlignment: false
68+
DisableFormat: false
69+
EmptyLineAfterAccessModifier: Never
70+
EmptyLineBeforeAccessModifier: LogicalBlock
6171
ExperimentalAutoDetectBinPacking: false
72+
PackConstructorInitializers: BinPack
73+
BasedOnStyle: ''
74+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
75+
AllowAllConstructorInitializersOnNextLine: true
6276
FixNamespaceComments: true
6377
ForEachMacros:
6478
- foreach
@@ -68,68 +82,114 @@ ForEachMacros:
6882
- TEST_CASE
6983
- DYNAMIC_SECTION
7084
- BENCHMARK
85+
IfMacros:
86+
- KJ_IF_MAYBE
7187
IncludeBlocks: Preserve
7288
IncludeCategories:
7389
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
7490
Priority: 2
91+
SortPriority: 0
92+
CaseSensitive: false
7593
- Regex: '^(<|"(gtest|isl|json)/)'
7694
Priority: 3
95+
SortPriority: 0
96+
CaseSensitive: false
7797
- Regex: '.*'
7898
Priority: 1
99+
SortPriority: 0
100+
CaseSensitive: false
79101
IncludeIsMainRegex: '(Test)?$'
102+
IncludeIsMainSourceRegex: ''
103+
IndentAccessModifiers: false
80104
IndentCaseLabels: true
105+
IndentCaseBlocks: false
106+
IndentGotoLabels: true
81107
IndentPPDirectives: None
108+
IndentExternBlock: AfterExternBlock
109+
IndentRequires: false
82110
IndentWidth: 4
83111
IndentWrappedFunctionNames: false
112+
InsertTrailingCommas: None
84113
JavaScriptQuotes: Leave
85114
JavaScriptWrapImports: true
86115
KeepEmptyLinesAtTheStartOfBlocks: true
116+
LambdaBodyIndentation: Signature
87117
MacroBlockBegin: ''
88118
MacroBlockEnd: ''
89119
MaxEmptyLinesToKeep: 2
90120
NamespaceIndentation: None
91121
ObjCBinPackProtocolList: Auto
92122
ObjCBlockIndentWidth: 4
123+
ObjCBreakBeforeNestedBlockParam: true
93124
ObjCSpaceAfterProperty: false
94125
ObjCSpaceBeforeProtocolList: true
95126
PenaltyBreakAssignment: 2
96127
PenaltyBreakBeforeFirstCallParameter: 19
97128
PenaltyBreakComment: 300
98129
PenaltyBreakFirstLessLess: 120
130+
PenaltyBreakOpenParenthesis: 0
99131
PenaltyBreakString: 1000
100132
PenaltyBreakTemplateDeclaration: 10
101133
PenaltyExcessCharacter: 1000000
102134
PenaltyReturnTypeOnItsOwnLine: 60
135+
PenaltyIndentedWhitespace: 0
103136
PointerAlignment: Left
137+
PPIndentWidth: -1
138+
ReferenceAlignment: Left
104139
ReflowComments: true
105-
SortIncludes: false
106-
SortUsingDeclarations: true
140+
RemoveBracesLLVM: false
141+
SeparateDefinitionBlocks: Leave
142+
ShortNamespaceLines: 1
143+
SortIncludes: Never
144+
SortJavaStaticImport: Before
145+
SortUsingDeclarations: false
107146
SpaceAfterCStyleCast: false
108147
SpaceAfterLogicalNot: false
109148
SpaceAfterTemplateKeyword: true
110149
SpaceBeforeAssignmentOperators: true
150+
SpaceBeforeCaseColon: false
111151
SpaceBeforeCpp11BracedList: false
112152
SpaceBeforeCtorInitializerColon: true
113153
SpaceBeforeInheritanceColon: true
114-
SpaceBeforeParens: ControlStatementsExceptForEachMacros
154+
SpaceBeforeParens: ControlStatementsExceptControlMacros
155+
SpaceBeforeParensOptions:
156+
AfterControlStatements: true
157+
AfterForeachMacros: false
158+
AfterFunctionDefinitionName: false
159+
AfterFunctionDeclarationName: false
160+
AfterIfMacros: false
161+
AfterOverloadedOperator: false
162+
BeforeNonEmptyParentheses: false
163+
SpaceAroundPointerQualifiers: Default
115164
SpaceBeforeRangeBasedForLoopColon: true
165+
SpaceInEmptyBlock: false
116166
SpaceInEmptyParentheses: false
117167
SpacesBeforeTrailingComments: 1
118-
SpacesInAngles: false
168+
SpacesInAngles: Never
169+
SpacesInConditionalStatement: false
119170
SpacesInContainerLiterals: true
120171
SpacesInCStyleCastParentheses: false
172+
SpacesInLineCommentPrefix:
173+
Minimum: 1
174+
Maximum: -1
121175
SpacesInParentheses: false
122176
SpacesInSquareBrackets: false
123-
Standard: Cpp11
177+
SpaceBeforeSquareBrackets: false
178+
BitFieldColonSpacing: Both
179+
Standard: Latest
180+
StatementAttributeLikeMacros:
181+
- Q_EMIT
124182
StatementMacros:
125183
- Q_UNUSED
126184
- QT_REQUIRE_VERSION
127185
TabWidth: 4
186+
UseCRLF: false
128187
UseTab: Never
129-
---
130-
Language: Cpp
131-
DisableFormat: false
132-
---
133-
Language: ObjC
134-
DisableFormat: false
188+
WhitespaceSensitiveMacros:
189+
- STRINGIZE
190+
- PP_STRINGIZE
191+
- BOOST_PP_STRINGIZE
192+
- NS_SWIFT_NAME
193+
- CF_SWIFT_NAME
135194
...
195+

.project

-9
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@
2525
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
2626
</natures>
2727
<filteredResources>
28-
<filter>
29-
<id>1684928805201</id>
30-
<name>external</name>
31-
<type>30</type>
32-
<matcher>
33-
<id>org.eclipse.ui.ide.multiFilter</id>
34-
<arguments>1.0-name-matches-false-false-catch</arguments>
35-
</matcher>
36-
</filter>
3728
<filter>
3829
<id>1684928848403</id>
3930
<name>src/external</name>

doc/development/coding_style_guide.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44

55
/*
6-
* The layout of the code is enforced by the use of clang-format - currently in version 3.9. The layout is
6+
* The layout of the code is enforced by the use of clang-format - currently in version 16. The layout is
77
* defined by the .clang-format configuration file in the project root. You can ensure that a code change
88
* complies with the formatting rules in the following ways:
99
*

src/realm/array_backlink.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ class ArrayBacklink : public ArrayPayload, private Array {
8686
void verify() const;
8787
bool verify_backlink(size_t ndx, int64_t link);
8888
};
89-
}
89+
} // namespace realm
9090

9191
#endif /* SRC_REALM_ARRAY_KEY_HPP_ */

src/realm/array_basic.hpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ class BasicArray : public Node, public ArrayPayload {
3333
using value_type = T;
3434

3535
explicit BasicArray(Allocator&) noexcept;
36-
~BasicArray() noexcept override
37-
{
38-
}
36+
~BasicArray() noexcept override {}
3937

4038
static T default_value(bool)
4139
{

src/realm/array_binary.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ inline BinaryData ArrayBinary::get(const char* header, size_t ndx, Allocator& al
107107
return ArrayBigBlobs::get(header, ndx, alloc);
108108
}
109109
}
110-
}
110+
} // namespace realm
111111

112112
#endif /* SRC_REALM_ARRAY_BINARY_HPP_ */

src/realm/array_blob.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ class ArrayBlob : public Array {
3131
static constexpr size_t max_binary_size = 0xFFFFF8 - Array::header_size;
3232

3333
explicit ArrayBlob(Allocator&) noexcept;
34-
~ArrayBlob() noexcept override
35-
{
36-
}
34+
~ArrayBlob() noexcept override {}
3735

3836
// Disable copying, this is not allowed.
3937
ArrayBlob& operator=(const ArrayBlob&) = delete;
@@ -67,6 +65,7 @@ class ArrayBlob : public Array {
6765
static MemRef create_array(size_t init_size, Allocator&);
6866

6967
void verify() const;
68+
7069
private:
7170
size_t calc_byte_len(size_t for_size, size_t width) const override;
7271
size_t calc_item_count(size_t bytes, size_t width) const noexcept override;

src/realm/array_blobs_big.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ void ArrayBigBlobs::find_all(IntegerColumn& result, BinaryData value, bool is_st
188188
}
189189

190190

191-
192191
void ArrayBigBlobs::verify() const
193192
{
194193
#ifdef REALM_DEBUG
@@ -204,4 +203,3 @@ void ArrayBigBlobs::verify() const
204203
}
205204
#endif
206205
}
207-

src/realm/array_blobs_big.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ inline BinaryData ArrayBigBlobs::get(const char* header, size_t ndx, Allocator&
129129
inline void ArrayBigBlobs::erase(size_t ndx)
130130
{
131131
ref_type blob_ref = Array::get_as_ref(ndx);
132-
if (blob_ref != 0) { // nothing to destroy if null
132+
if (blob_ref != 0) { // nothing to destroy if null
133133
Array::destroy_deep(blob_ref, get_alloc()); // Deep
134134
}
135135
Array::erase(ndx);

src/realm/array_blobs_small.hpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ in set(), etc). This way no file format upgrade is needed to support nulls for B
5454
class ArraySmallBlobs : public Array {
5555
public:
5656
explicit ArraySmallBlobs(Allocator&) noexcept;
57-
~ArraySmallBlobs() noexcept override
58-
{
59-
}
57+
~ArraySmallBlobs() noexcept override {}
6058

6159
// Disable copying, this is not allowed.
6260
ArraySmallBlobs& operator=(const ArraySmallBlobs&) = delete;

src/realm/array_bool.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,6 @@ class ArrayBoolNull : public ArrayBool {
152152
return (val == null_value) ? util::none : util::make_optional(val != 0);
153153
}
154154
};
155-
}
155+
} // namespace realm
156156

157157
#endif /* REALM_ARRAY_BOOL_HPP */

src/realm/array_direct.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,6 @@ inline size_t upper_bound(const char* data, size_t size, int64_t value) noexcept
350350

351351
return low;
352352
}
353-
}
353+
} // namespace realm
354354

355355
#endif /* ARRAY_TPL_HPP_ */

src/realm/array_integer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int64_t next_null_candidate(int64_t previous_candidate)
7070
x += 0xfffffffbULL;
7171
return int64_t(x);
7272
}
73-
}
73+
} // namespace
7474

7575
int_fast64_t ArrayIntNull::choose_random_null(int64_t incoming) const
7676
{

src/realm/array_key.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ class ArrayKeyNonNullable : public ArrayKeyBase<0> {
128128
public:
129129
using ArrayKeyBase::ArrayKeyBase;
130130
};
131-
}
131+
} // namespace realm
132132

133133
#endif /* SRC_REALM_ARRAY_KEY_HPP_ */

src/realm/array_list.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ class ArrayList : public ArrayPayload, private Array {
9595
return Array::find_first(from_ref(value), begin, end);
9696
}
9797
};
98-
}
98+
} // namespace realm
9999

100100
#endif /* REALM_ARRAY_LIST_HPP */

src/realm/array_string.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ size_t lower_bound_string(const T* arr, U value)
358358
}
359359
return i;
360360
}
361-
}
361+
} // namespace
362362

363363
size_t ArrayString::lower_bound(StringData value)
364364
{

src/realm/array_string.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,6 @@ inline StringData ArrayString::get(const char* header, size_t ndx, Allocator& al
160160
}
161161
}
162162

163-
}
163+
} // namespace realm
164164

165165
#endif /* REALM_ARRAY_STRING_HPP */

src/realm/array_string_short.hpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ class ArrayStringShort : public Array {
4848
// Constructor defaults to non-nullable because we use non-nullable ArrayStringShort so many places internally
4949
// in core (data which isn't user payload) where null isn't needed.
5050
explicit ArrayStringShort(Allocator&, bool nullable = false) noexcept;
51-
~ArrayStringShort() noexcept override
52-
{
53-
}
51+
~ArrayStringShort() noexcept override {}
5452

5553
bool is_null(size_t ndx) const;
5654
void set_null(size_t ndx);

0 commit comments

Comments
 (0)