Skip to content

Commit 89dd3af

Browse files
authored
Limit number of columns in framework to 120 (#1491)
* Limit number of columns in framework/common to 120 * Resolve conflicts
1 parent fc51e9c commit 89dd3af

14 files changed

Lines changed: 533 additions & 390 deletions

framework/common/.clang-format

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: true
8+
AlignEscapedNewlines: Left
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: None
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: true
21+
BinPackArguments: false
22+
BinPackParameters: false
23+
BraceWrapping:
24+
AfterCaseLabel: true
25+
AfterClass: true
26+
AfterControlStatement: true
27+
AfterEnum: true
28+
AfterFunction: true
29+
AfterNamespace: true
30+
AfterObjCDeclaration: true
31+
AfterStruct: true
32+
AfterUnion: true
33+
AfterExternBlock: true
34+
BeforeCatch: true
35+
BeforeElse: true
36+
IndentBraces: false
37+
SplitEmptyFunction: false
38+
SplitEmptyRecord: false
39+
SplitEmptyNamespace: false
40+
BreakBeforeBinaryOperators: None
41+
BreakBeforeBraces: Custom
42+
BreakBeforeInheritanceComma: false
43+
BreakBeforeTernaryOperators: false
44+
BreakConstructorInitializersBeforeComma: false
45+
BreakConstructorInitializers: AfterColon
46+
BreakAfterJavaFieldAnnotations: false
47+
BreakStringLiterals: true
48+
ColumnLimit: 120
49+
CommentPragmas: '^ IWYU pragma:'
50+
CompactNamespaces: false
51+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
52+
ConstructorInitializerIndentWidth: 4
53+
ContinuationIndentWidth: 4
54+
Cpp11BracedListStyle: true
55+
DerivePointerAlignment: false
56+
DisableFormat: false
57+
ExperimentalAutoDetectBinPacking: false
58+
FixNamespaceComments: true
59+
ForEachMacros:
60+
- foreach
61+
- Q_FOREACH
62+
- BOOST_FOREACH
63+
IncludeBlocks: Preserve
64+
IncludeIsMainRegex: '(Test)?$'
65+
IndentCaseLabels: true
66+
IndentPPDirectives: AfterHash
67+
IndentWidth: 4
68+
IndentWrappedFunctionNames: true
69+
JavaScriptQuotes: Leave
70+
JavaScriptWrapImports: true
71+
KeepEmptyLinesAtTheStartOfBlocks: false
72+
MacroBlockBegin: ''
73+
MacroBlockEnd: ''
74+
MaxEmptyLinesToKeep: 1
75+
NamespaceIndentation: None
76+
ObjCBinPackProtocolList: Auto
77+
ObjCBlockIndentWidth: 2
78+
ObjCSpaceAfterProperty: false
79+
ObjCSpaceBeforeProtocolList: true
80+
PenaltyBreakAssignment: 2
81+
PenaltyBreakBeforeFirstCallParameter: 19
82+
PenaltyBreakComment: 300
83+
PenaltyBreakFirstLessLess: 120
84+
PenaltyBreakString: 1000
85+
PenaltyExcessCharacter: 1000000
86+
PenaltyReturnTypeOnItsOwnLine: 60
87+
PointerAlignment: Right
88+
ReflowComments: false
89+
SortIncludes: true
90+
SortUsingDeclarations: true
91+
SpaceAfterCStyleCast: true
92+
SpaceAfterTemplateKeyword: true
93+
SpaceBeforeAssignmentOperators: true
94+
SpaceBeforeCtorInitializerColon: true
95+
SpaceBeforeInheritanceColon: true
96+
SpaceBeforeParens: ControlStatements
97+
SpaceBeforeRangeBasedForLoopColon: true
98+
SpaceInEmptyParentheses: false
99+
SpacesBeforeTrailingComments: 8
100+
SpacesInAngles: false
101+
SpacesInContainerLiterals: false
102+
SpacesInCStyleCastParentheses: false
103+
SpacesInParentheses: false
104+
SpacesInSquareBrackets: false
105+
Standard: Cpp11
106+
TabWidth: 4
107+
UseTab: ForIndentation
108+
---
109+
Language: ObjC
110+
DisableFormat: true
111+
...

framework/common/error.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2018-2020, Arm Limited and Contributors
1+
/* Copyright (c) 2018-2026, Arm Limited and Contributors
22
*
33
* SPDX-License-Identifier: Apache-2.0
44
*
@@ -22,8 +22,7 @@
2222
namespace vkb
2323
{
2424
VulkanException::VulkanException(const VkResult result, const std::string &msg) :
25-
result{result},
26-
std::runtime_error{msg}
25+
result{result}, std::runtime_error{msg}
2726
{
2827
error_message = std::string(std::runtime_error::what()) + std::string{" : "} + to_string(result);
2928
}

framework/common/helpers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ namespace vkb
4343
{
4444
inline bool contains(uint32_t range_count, char const *const *range, char const *value)
4545
{
46-
return std::any_of(range, range + range_count, [value](char const *range_value) { return strcmp(range_value, value) == 0; });
46+
return std::any_of(
47+
range, range + range_count, [value](char const *range_value) { return strcmp(range_value, value) == 0; });
4748
}
4849

4950
inline bool contains(std::vector<std::string> const &range, char const *value)

framework/common/hpp_resource_caching.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ struct hash<vkb::core::HPPDescriptorSetLayout>
111111
{
112112
size_t operator()(const vkb::core::HPPDescriptorSetLayout &descriptor_set_layout) const
113113
{
114-
return std::hash<vkb::DescriptorSetLayout>()(reinterpret_cast<vkb::DescriptorSetLayout const &>(descriptor_set_layout));
114+
return std::hash<vkb::DescriptorSetLayout>()(
115+
reinterpret_cast<vkb::DescriptorSetLayout const &>(descriptor_set_layout));
115116
}
116117
};
117118

@@ -338,7 +339,10 @@ struct HPPRecordHelper<vkb::core::HPPGraphicsPipeline, A...>
338339
} // namespace
339340

340341
template <class T, class... A>
341-
T &request_resource(vkb::core::DeviceCpp &device, vkb::HPPResourceRecord *recorder, std::unordered_map<size_t, T> &resources, A &...args)
342+
T &request_resource(vkb::core::DeviceCpp &device,
343+
vkb::HPPResourceRecord *recorder,
344+
std::unordered_map<size_t, T> &resources,
345+
A &...args)
342346
{
343347
HPPRecordHelper<T, A...> record_helper;
344348

@@ -369,7 +373,8 @@ T &request_resource(vkb::core::DeviceCpp &device, vkb::HPPResourceRecord *record
369373

370374
if (!res_ins_it.second)
371375
{
372-
throw std::runtime_error{std::string{"Insertion error for #"} + std::to_string(res_id) + "cache object (" + res_type + ")"};
376+
throw std::runtime_error{std::string{"Insertion error for #"} + std::to_string(res_id) + "cache object (" +
377+
res_type + ")"};
373378
}
374379

375380
res_it = res_ins_it.first;

framework/common/hpp_utils.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ namespace vkb
2626
{
2727
namespace common
2828
{
29-
inline vkb::scene_graph::NodeCpp &add_free_camera(vkb::scene_graph::SceneCpp &scene, const std::string &node_name, vk::Extent2D const &extent)
29+
inline vkb::scene_graph::NodeCpp &
30+
add_free_camera(vkb::scene_graph::SceneCpp &scene, const std::string &node_name, vk::Extent2D const &extent)
3031
{
31-
return reinterpret_cast<vkb::scene_graph::NodeCpp &>(
32-
vkb::add_free_camera(reinterpret_cast<vkb::scene_graph::SceneC &>(scene), node_name, static_cast<VkExtent2D>(extent)));
32+
return reinterpret_cast<vkb::scene_graph::NodeCpp &>(vkb::add_free_camera(
33+
reinterpret_cast<vkb::scene_graph::SceneC &>(scene), node_name, static_cast<VkExtent2D>(extent)));
3334
}
3435

3536
inline void screenshot(vkb::rendering::RenderContextCpp &render_context, const std::string &filename)

0 commit comments

Comments
 (0)