Skip to content

Commit 24ce90b

Browse files
committed
run clang-format
1 parent 06081e2 commit 24ce90b

Some content is hidden

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

54 files changed

+715
-601
lines changed

.clang-format

Lines changed: 107 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,56 @@
11
---
2-
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
3-
# We'll use defaults from the LLVM style, but with 4 columns indentation.
4-
BasedOnStyle: LLVM
5-
IndentWidth: 4
6-
---
72
Language: Cpp
83
AccessModifierOffset: 0
94
AlignAfterOpenBracket: Align
10-
AlignConsecutiveAssignments: false
11-
AlignConsecutiveDeclarations: false
5+
AlignArrayOfStructures: None
6+
AlignConsecutiveAssignments:
7+
Enabled: false
8+
AcrossEmptyLines: false
9+
AcrossComments: false
10+
AlignCompound: false
11+
PadOperators: true
12+
AlignConsecutiveBitFields:
13+
Enabled: false
14+
AcrossEmptyLines: false
15+
AcrossComments: false
16+
AlignCompound: false
17+
PadOperators: false
18+
AlignConsecutiveDeclarations:
19+
Enabled: false
20+
AcrossEmptyLines: false
21+
AcrossComments: false
22+
AlignCompound: false
23+
PadOperators: true
24+
AlignConsecutiveMacros:
25+
Enabled: false
26+
AcrossEmptyLines: false
27+
AcrossComments: false
28+
AlignCompound: false
29+
PadOperators: false
1230
AlignEscapedNewlines: Left
13-
AlignOperands: true
31+
AlignOperands: Align
1432
AlignTrailingComments: true
33+
AllowAllArgumentsOnNextLine: true
1534
AllowAllParametersOfDeclarationOnNextLine: true
16-
AllowShortBlocksOnASingleLine: false
35+
AllowShortEnumsOnASingleLine: true
36+
AllowShortBlocksOnASingleLine: Never
1737
AllowShortCaseLabelsOnASingleLine: false
18-
AllowShortLambdasOnASingleLine: false
1938
AllowShortFunctionsOnASingleLine: Empty
20-
AllowShortIfStatementsOnASingleLine: false
39+
AllowShortLambdasOnASingleLine: None
40+
AllowShortIfStatementsOnASingleLine: Never
2141
AllowShortLoopsOnASingleLine: true
2242
AlwaysBreakAfterDefinitionReturnType: None
2343
AlwaysBreakAfterReturnType: None
2444
AlwaysBreakBeforeMultilineStrings: true
2545
AlwaysBreakTemplateDeclarations: Yes
46+
AttributeMacros:
47+
- __capability
2648
BinPackArguments: false
2749
BinPackParameters: false
2850
BraceWrapping:
51+
AfterCaseLabel: false
2952
AfterClass: false
30-
AfterControlStatement: false
53+
AfterControlStatement: Never
3154
AfterEnum: false
3255
AfterFunction: false
3356
AfterNamespace: false
@@ -37,11 +60,14 @@ BraceWrapping:
3760
AfterExternBlock: false
3861
BeforeCatch: false
3962
BeforeElse: false
63+
BeforeLambdaBody: false
64+
BeforeWhile: false
4065
IndentBraces: false
4166
SplitEmptyFunction: true
4267
SplitEmptyRecord: true
4368
SplitEmptyNamespace: true
4469
BreakBeforeBinaryOperators: None
70+
BreakBeforeConceptDeclarations: Always
4571
BreakBeforeBraces: Attach
4672
BreakBeforeInheritanceComma: false
4773
BreakInheritanceList: BeforeComma
@@ -52,76 +78,139 @@ BreakAfterJavaFieldAnnotations: false
5278
BreakStringLiterals: true
5379
ColumnLimit: 120
5480
CommentPragmas: '^ IWYU pragma:'
81+
QualifierAlignment: Leave
5582
CompactNamespaces: true
56-
ConstructorInitializerAllOnOneLineOrOnePerLine: true
5783
ConstructorInitializerIndentWidth: 4
5884
ContinuationIndentWidth: 4
5985
Cpp11BracedListStyle: true
86+
DeriveLineEnding: true
6087
DerivePointerAlignment: false
6188
DisableFormat: false
89+
EmptyLineAfterAccessModifier: Never
90+
EmptyLineBeforeAccessModifier: LogicalBlock
6291
ExperimentalAutoDetectBinPacking: false
92+
PackConstructorInitializers: NextLine
93+
BasedOnStyle: ''
94+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
95+
AllowAllConstructorInitializersOnNextLine: true
6396
FixNamespaceComments: true
6497
ForEachMacros:
6598
- foreach
6699
- Q_FOREACH
67100
- BOOST_FOREACH
101+
IfMacros:
102+
- KJ_IF_MAYBE
68103
IncludeBlocks: Preserve
69104
IncludeCategories:
70105
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
71106
Priority: 2
107+
SortPriority: 0
108+
CaseSensitive: false
72109
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
73110
Priority: 3
111+
SortPriority: 0
112+
CaseSensitive: false
74113
- Regex: '.*'
75114
Priority: 1
115+
SortPriority: 0
116+
CaseSensitive: false
76117
IncludeIsMainRegex: '(Test)?$'
118+
IncludeIsMainSourceRegex: ''
119+
IndentAccessModifiers: false
77120
IndentCaseLabels: true
121+
IndentCaseBlocks: false
122+
IndentGotoLabels: true
78123
IndentPPDirectives: BeforeHash
124+
IndentExternBlock: AfterExternBlock
125+
IndentRequiresClause: true
79126
IndentWidth: 4
80127
IndentWrappedFunctionNames: true
128+
InsertBraces: false
129+
InsertTrailingCommas: None
81130
JavaScriptQuotes: Leave
82131
JavaScriptWrapImports: true
83132
KeepEmptyLinesAtTheStartOfBlocks: true
133+
LambdaBodyIndentation: Signature
84134
MacroBlockBegin: ''
85135
MacroBlockEnd: ''
86136
MaxEmptyLinesToKeep: 2
87137
NamespaceIndentation: None
88138
ObjCBinPackProtocolList: Auto
89139
ObjCBlockIndentWidth: 2
140+
ObjCBreakBeforeNestedBlockParam: true
90141
ObjCSpaceAfterProperty: false
91142
ObjCSpaceBeforeProtocolList: true
92143
PenaltyBreakAssignment: 2
93144
PenaltyBreakBeforeFirstCallParameter: 19
94145
PenaltyBreakComment: 300
95146
PenaltyBreakFirstLessLess: 120
147+
PenaltyBreakOpenParenthesis: 0
96148
PenaltyBreakString: 1000
97149
PenaltyBreakTemplateDeclaration: 10
98150
PenaltyExcessCharacter: 1000000
99151
PenaltyReturnTypeOnItsOwnLine: 60
152+
PenaltyIndentedWhitespace: 0
100153
PointerAlignment: Left
154+
PPIndentWidth: -1
155+
ReferenceAlignment: Pointer
101156
ReflowComments: true
102-
SortIncludes: true
157+
RemoveBracesLLVM: false
158+
RequiresClausePosition: OwnLine
159+
SeparateDefinitionBlocks: Leave
160+
ShortNamespaceLines: 1
161+
SortIncludes: CaseSensitive
162+
SortJavaStaticImport: Before
103163
SortUsingDeclarations: false
104164
SpaceAfterCStyleCast: true
105-
SpaceAfterTemplateKeyword: false
165+
SpaceAfterLogicalNot: false
166+
SpaceAfterTemplateKeyword: true
106167
SpaceBeforeAssignmentOperators: true
168+
SpaceBeforeCaseColon: false
107169
SpaceBeforeCpp11BracedList: false
108170
SpaceBeforeCtorInitializerColon: true
109171
SpaceBeforeInheritanceColon: true
110172
SpaceBeforeParens: ControlStatements
173+
SpaceBeforeParensOptions:
174+
AfterControlStatements: true
175+
AfterForeachMacros: true
176+
AfterFunctionDefinitionName: false
177+
AfterFunctionDeclarationName: false
178+
AfterIfMacros: true
179+
AfterOverloadedOperator: false
180+
AfterRequiresInClause: false
181+
AfterRequiresInExpression: false
182+
BeforeNonEmptyParentheses: false
183+
SpaceAroundPointerQualifiers: Default
111184
SpaceBeforeRangeBasedForLoopColon: true
185+
SpaceInEmptyBlock: false
112186
SpaceInEmptyParentheses: false
113187
SpacesBeforeTrailingComments: 1
114-
SpacesInAngles: false
188+
SpacesInAngles: Never
189+
SpacesInConditionalStatement: false
115190
SpacesInContainerLiterals: true
116191
SpacesInCStyleCastParentheses: false
192+
SpacesInLineCommentPrefix:
193+
Minimum: 1
194+
Maximum: -1
117195
SpacesInParentheses: false
118196
SpacesInSquareBrackets: false
119-
Standard: Cpp11
197+
SpaceBeforeSquareBrackets: false
198+
BitFieldColonSpacing: Both
199+
Standard: Latest
200+
StatementAttributeLikeMacros:
201+
- Q_EMIT
120202
StatementMacros:
121203
- Q_UNUSED
204+
- Q_DEBUG
122205
- QT_REQUIRE_VERSION
123206
TabWidth: 4
207+
UseCRLF: false
124208
UseTab: Never
209+
WhitespaceSensitiveMacros:
210+
- STRINGIZE
211+
- PP_STRINGIZE
212+
- BOOST_PP_STRINGIZE
213+
- NS_SWIFT_NAME
214+
- CF_SWIFT_NAME
125215
...
126216

127-

.conan/test_package/test_package.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33

44
#include <cstdlib>
55
#include <iostream>
6-
#include <vector>
76
#include <string>
7+
#include <vector>
88

99
#include <ext/util/show.hpp>
1010

11-
int main()
12-
{
11+
int main() {
1312
std::vector<std::string> out{"ext::basics", "successfully", "installs"};
1413
using ext::util::operator<<;
1514
std::cout << "\n\n" << out << "\n" << std::endl;

.github/workflows/clang-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- uses: DoozyX/[email protected]
2020
with:
2121
extensions: 'hpp,cpp'
22-
clangFormatVersion: 14
22+
clangFormatVersion: 15

examples/show.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int main(/*int argc, const char *argv[]*/) {
3434

3535
// prefer this!
3636
std::cout << vec2 << std::endl;
37-
#endif
37+
#endif // CLANG_ANALYZE
3838

3939
return 0;
4040
}

examples/tagged_pointer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright - 2020 - Jan Christoph Uhde <[email protected]>
22
// Please see LICENSE.md for license or visit https://github.com/extcpp/basics
33
#include <ext/memory/tagged_pointer.hpp>
4-
#include <ext/util/bit_tricks.hpp>
54
#include <ext/meta/basic.hpp>
5+
#include <ext/util/bit_tricks.hpp>
66

77
#include <atomic>
88
#include <iostream>

include/ext/algorithm/basic.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <vector>
1111
namespace ext { namespace algorithm {
1212

13-
template<typename T, typename Predicate, bool stable = false>
13+
template <typename T, typename Predicate, bool stable = false>
1414
std::vector<T> partition_out(std::vector<T>& vec, Predicate pred) {
1515
auto end = vec.end();
1616
decltype(end) split_point;
@@ -30,43 +30,43 @@ std::vector<T> partition_out(std::vector<T>& vec, Predicate pred) {
3030
return out;
3131
}
3232

33-
template<typename T, typename Predicate>
33+
template <typename T, typename Predicate>
3434
std::vector<T> stable_partition_out(std::vector<T>& vec, Predicate&& pred) {
3535
return partition_out<T, Predicate, true>(vec, std::forward<Predicate>(pred));
3636
}
3737

38-
template<typename T, typename Predicate = std::less<>>
38+
template <typename T, typename Predicate = std::less<>>
3939
T const& min(T const& a, T const& b, T const& c, Predicate comp = Predicate()) {
4040
return std::min(a, std::min(b, c, comp), comp);
4141
}
4242

43-
template<typename T, typename Predicate = std::less<>>
43+
template <typename T, typename Predicate = std::less<>>
4444
T const& max(T const& a, T const& b, T const& c, Predicate comp = Predicate()) {
4545
return std::max(std::max(a, b, comp), c, comp);
4646
}
4747

48-
template<typename T>
48+
template <typename T>
4949
T&& min(T&& x) {
5050
return std::forward<T>(x);
5151
}
5252

53-
template<typename T1, typename T2, typename... Ts>
53+
template <typename T1, typename T2, typename... Ts>
5454
decltype(auto) min(T1&& x1, T2&& x2, Ts&&... xs) {
5555
return (x1 < x2) ? min(x1, std::forward<Ts>(xs)...) : min(x2, std::forward<Ts>(xs)...);
5656
}
5757

58-
template<typename T>
58+
template <typename T>
5959
T&& max(T&& x) {
6060
return std::forward<T>(x);
6161
}
6262

63-
template<typename T1, typename T2, typename... Ts>
63+
template <typename T1, typename T2, typename... Ts>
6464
decltype(auto) max(T1&& x1, T2&& x2, Ts&&... xs) {
6565
return (x1 > x2) ? max(x1, std::forward<Ts>(xs)...) : max(x2, std::forward<Ts>(xs)...);
6666
}
6767

6868
// count occurrences in container /////////////////////////////////////////
69-
template<typename Iterator, typename Int = std::size_t>
69+
template <typename Iterator, typename Int = std::size_t>
7070
auto count_occurrences(Iterator begin, Iterator end) {
7171
using Key = typename std::iterator_traits<Iterator>::value_type;
7272
std::map<Key, Int> result;
@@ -76,7 +76,7 @@ auto count_occurrences(Iterator begin, Iterator end) {
7676
return result;
7777
}
7878

79-
template<typename Container, typename Int = int>
79+
template <typename Container, typename Int = int>
8080
auto count_occurrences(const Container& container) {
8181
using Iterator = decltype(std::begin(container));
8282
return count_occurrences<Iterator, Int>(std::begin(container), std::end(container));
@@ -85,7 +85,7 @@ auto count_occurrences(const Container& container) {
8585
// merge maps //////////////////////////////////////////////////////////////
8686
// Items that are already present in the first map get replaced if
8787
// the predicate evaluates to true
88-
template<typename Map, typename Predicate = std::not_equal_to<>>
88+
template <typename Map, typename Predicate = std::not_equal_to<>>
8989
auto& merge_maps(Map& modify, const Map& add, Predicate predicate = Predicate()) {
9090
for (auto it = add.begin(); it != add.end(); it++) {
9191
auto found = modify.find(it->first);

0 commit comments

Comments
 (0)