Skip to content

Commit

Permalink
Reformat code (#7622)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedelbo authored Apr 26, 2024
1 parent f48fa55 commit 0d73fdd
Show file tree
Hide file tree
Showing 132 changed files with 1,206 additions and 945 deletions.
104 changes: 82 additions & 22 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# Don't try to format any languages not described by this file
DisableFormat: true
BasedOnStyle: LLVM
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: true
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: Empty
Expand All @@ -23,12 +23,14 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
Expand All @@ -38,27 +40,39 @@ BraceWrapping:
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 118
CommentPragmas: '^ IWYU pragma:'
QualifierAlignment: Leave
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
PackConstructorInitializers: BinPack
BasedOnStyle: ''
ConstructorInitializerAllOnOneLineOrOnePerLine: false
AllowAllConstructorInitializersOnNextLine: true
FixNamespaceComments: true
ForEachMacros:
- foreach
Expand All @@ -68,68 +82,114 @@ ForEachMacros:
- TEST_CASE
- DYNAMIC_SECTION
- BENCHMARK
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
PPIndentWidth: -1
ReferenceAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: Never
SortJavaStaticImport: Before
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatementsExceptForEachMacros
SpaceBeforeParens: ControlStatementsExceptControlMacros
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: false
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: false
AfterOverloadedOperator: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
---
Language: Cpp
DisableFormat: false
---
Language: ObjC
DisableFormat: false
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

9 changes: 0 additions & 9 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<filteredResources>
<filter>
<id>1684928805201</id>
<name>external</name>
<type>30</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-catch</arguments>
</matcher>
</filter>
<filter>
<id>1684928848403</id>
<name>src/external</name>
Expand Down
2 changes: 1 addition & 1 deletion doc/development/coding_style_guide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//

/*
* The layout of the code is enforced by the use of clang-format - currently in version 3.9. The layout is
* The layout of the code is enforced by the use of clang-format - currently in version 16. The layout is
* defined by the .clang-format configuration file in the project root. You can ensure that a code change
* complies with the formatting rules in the following ways:
*
Expand Down
2 changes: 1 addition & 1 deletion src/realm/array_backlink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ class ArrayBacklink : public ArrayPayload, private Array {
void verify() const;
bool verify_backlink(size_t ndx, int64_t link);
};
}
} // namespace realm

#endif /* SRC_REALM_ARRAY_KEY_HPP_ */
4 changes: 1 addition & 3 deletions src/realm/array_basic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class BasicArray : public Node, public ArrayPayload {
using value_type = T;

explicit BasicArray(Allocator&) noexcept;
~BasicArray() noexcept override
{
}
~BasicArray() noexcept override {}

static T default_value(bool)
{
Expand Down
2 changes: 1 addition & 1 deletion src/realm/array_binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ inline BinaryData ArrayBinary::get(const char* header, size_t ndx, Allocator& al
return ArrayBigBlobs::get(header, ndx, alloc);
}
}
}
} // namespace realm

#endif /* SRC_REALM_ARRAY_BINARY_HPP_ */
5 changes: 2 additions & 3 deletions src/realm/array_blob.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ class ArrayBlob : public Array {
static constexpr size_t max_binary_size = 0xFFFFF8 - Array::header_size;

explicit ArrayBlob(Allocator&) noexcept;
~ArrayBlob() noexcept override
{
}
~ArrayBlob() noexcept override {}

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

void verify() const;

private:
size_t calc_byte_len(size_t for_size, size_t width) const override;
size_t calc_item_count(size_t bytes, size_t width) const noexcept override;
Expand Down
2 changes: 0 additions & 2 deletions src/realm/array_blobs_big.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ void ArrayBigBlobs::find_all(IntegerColumn& result, BinaryData value, bool is_st
}



void ArrayBigBlobs::verify() const
{
#ifdef REALM_DEBUG
Expand All @@ -204,4 +203,3 @@ void ArrayBigBlobs::verify() const
}
#endif
}

2 changes: 1 addition & 1 deletion src/realm/array_blobs_big.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ inline BinaryData ArrayBigBlobs::get(const char* header, size_t ndx, Allocator&
inline void ArrayBigBlobs::erase(size_t ndx)
{
ref_type blob_ref = Array::get_as_ref(ndx);
if (blob_ref != 0) { // nothing to destroy if null
if (blob_ref != 0) { // nothing to destroy if null
Array::destroy_deep(blob_ref, get_alloc()); // Deep
}
Array::erase(ndx);
Expand Down
4 changes: 1 addition & 3 deletions src/realm/array_blobs_small.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ in set(), etc). This way no file format upgrade is needed to support nulls for B
class ArraySmallBlobs : public Array {
public:
explicit ArraySmallBlobs(Allocator&) noexcept;
~ArraySmallBlobs() noexcept override
{
}
~ArraySmallBlobs() noexcept override {}

// Disable copying, this is not allowed.
ArraySmallBlobs& operator=(const ArraySmallBlobs&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion src/realm/array_bool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ class ArrayBoolNull : public ArrayBool {
return (val == null_value) ? util::none : util::make_optional(val != 0);
}
};
}
} // namespace realm

#endif /* REALM_ARRAY_BOOL_HPP */
2 changes: 1 addition & 1 deletion src/realm/array_direct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,6 @@ inline size_t upper_bound(const char* data, size_t size, int64_t value) noexcept

return low;
}
}
} // namespace realm

#endif /* ARRAY_TPL_HPP_ */
2 changes: 1 addition & 1 deletion src/realm/array_integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int64_t next_null_candidate(int64_t previous_candidate)
x += 0xfffffffbULL;
return int64_t(x);
}
}
} // namespace

int_fast64_t ArrayIntNull::choose_random_null(int64_t incoming) const
{
Expand Down
2 changes: 1 addition & 1 deletion src/realm/array_key.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ class ArrayKeyNonNullable : public ArrayKeyBase<0> {
public:
using ArrayKeyBase::ArrayKeyBase;
};
}
} // namespace realm

#endif /* SRC_REALM_ARRAY_KEY_HPP_ */
2 changes: 1 addition & 1 deletion src/realm/array_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ class ArrayList : public ArrayPayload, private Array {
return Array::find_first(from_ref(value), begin, end);
}
};
}
} // namespace realm

#endif /* REALM_ARRAY_LIST_HPP */
2 changes: 1 addition & 1 deletion src/realm/array_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ size_t lower_bound_string(const T* arr, U value)
}
return i;
}
}
} // namespace

size_t ArrayString::lower_bound(StringData value)
{
Expand Down
2 changes: 1 addition & 1 deletion src/realm/array_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,6 @@ inline StringData ArrayString::get(const char* header, size_t ndx, Allocator& al
}
}

}
} // namespace realm

#endif /* REALM_ARRAY_STRING_HPP */
4 changes: 1 addition & 3 deletions src/realm/array_string_short.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ class ArrayStringShort : public Array {
// Constructor defaults to non-nullable because we use non-nullable ArrayStringShort so many places internally
// in core (data which isn't user payload) where null isn't needed.
explicit ArrayStringShort(Allocator&, bool nullable = false) noexcept;
~ArrayStringShort() noexcept override
{
}
~ArrayStringShort() noexcept override {}

bool is_null(size_t ndx) const;
void set_null(size_t ndx);
Expand Down
Loading

0 comments on commit 0d73fdd

Please sign in to comment.