Skip to content

Commit 2450dee

Browse files
committed
Merge pull request #93401 from Repiteo/style/clang-tidy-fixes
Style: Apply `clang-tidy` fixes
2 parents 7d950c1 + 2dcfdde commit 2450dee

File tree

67 files changed

+166
-149
lines changed

Some content is hidden

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

67 files changed

+166
-149
lines changed

.clang-tidy

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
---
2-
Checks: >-
3-
-*,
4-
cppcoreguidelines-pro-type-member-init,
5-
modernize-redundant-void-arg,
6-
modernize-use-bool-literals,
7-
modernize-use-default-member-init,
8-
modernize-use-nullptr,
9-
readability-braces-around-statements,
10-
readability-redundant-member-init
11-
WarningsAsErrors: ''
1+
Checks:
2+
- -*
3+
- cppcoreguidelines-pro-type-member-init
4+
- modernize-redundant-void-arg
5+
- modernize-use-bool-literals
6+
- modernize-use-default-member-init
7+
- modernize-use-nullptr
8+
- readability-braces-around-statements
9+
- readability-redundant-member-init
1210
HeaderFileExtensions: ['', h, hh, hpp, hxx, inc, glsl]
1311
ImplementationFileExtensions: [c, cc, cpp, cxx, m, mm, java]
1412
HeaderFilterRegex: (core|doc|drivers|editor|main|modules|platform|scene|servers|tests)/
@@ -19,4 +17,3 @@ CheckOptions:
1917
modernize-use-bool-literals.IgnoreMacros: false
2018
modernize-use-default-member-init.IgnoreMacros: false
2119
modernize-use-default-member-init.UseAssignment: true
22-
...

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,6 @@ b37fc1014abf7adda70dc30b0822d775b3a4433f
6060

6161
# Set clang-format `RemoveSemicolon` rule to `true`
6262
0d350e71086fffce0553811739aae9f6ad66136c
63+
64+
# Style: Apply clang-tidy fixes (superficial)
65+
bb5f390fb9b466be35a5df7651323d7e66afca31

core/input/input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ void Input::action_release(const StringName &p_action) {
10341034

10351035
// Create or retrieve existing action.
10361036
ActionState &action_state = action_states[p_action];
1037-
action_state.cache.pressed = 0;
1037+
action_state.cache.pressed = false;
10381038
action_state.cache.strength = 0.0;
10391039
action_state.cache.raw_strength = 0.0;
10401040
// As input may come in part way through a physics tick, the earliest we can react to it is the next physics tick.

core/object/message_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class CallQueue {
153153
bool is_flushing() const;
154154
int get_max_buffer_usage() const;
155155

156-
CallQueue(Allocator *p_custom_allocator = 0, uint32_t p_max_pages = 8192, const String &p_error_text = String());
156+
CallQueue(Allocator *p_custom_allocator = nullptr, uint32_t p_max_pages = 8192, const String &p_error_text = String());
157157
virtual ~CallQueue();
158158
};
159159

core/typedefs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,4 @@ struct BuildIndexSequence<0, Is...> : IndexSequence<Is...> {};
315315
#define ___gd_is_defined(val) ____gd_is_defined(__GDARG_PLACEHOLDER_##val)
316316
#define GD_IS_DEFINED(x) ___gd_is_defined(x)
317317

318-
#define FORCE_SEMICOLON ;
319-
320318
#endif // TYPEDEFS_H

core/variant/variant.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2719,8 +2719,7 @@ Variant::Variant(const Vector<Plane> &p_array) :
27192719
}
27202720
}
27212721

2722-
Variant::Variant(const Vector<Face3> &p_face_array) :
2723-
type(NIL) {
2722+
Variant::Variant(const Vector<Face3> &p_face_array) {
27242723
PackedVector3Array vertices;
27252724
int face_count = p_face_array.size();
27262725
vertices.resize(face_count * 3);
@@ -2739,8 +2738,7 @@ Variant::Variant(const Vector<Face3> &p_face_array) :
27392738
*this = vertices;
27402739
}
27412740

2742-
Variant::Variant(const Vector<Variant> &p_array) :
2743-
type(NIL) {
2741+
Variant::Variant(const Vector<Variant> &p_array) {
27442742
Array arr;
27452743
arr.resize(p_array.size());
27462744
for (int i = 0; i < p_array.size(); i++) {
@@ -2749,8 +2747,7 @@ Variant::Variant(const Vector<Variant> &p_array) :
27492747
*this = arr;
27502748
}
27512749

2752-
Variant::Variant(const Vector<StringName> &p_array) :
2753-
type(NIL) {
2750+
Variant::Variant(const Vector<StringName> &p_array) {
27542751
PackedStringArray v;
27552752
int len = p_array.size();
27562753
v.resize(len);
@@ -2908,8 +2905,7 @@ Variant::Variant(const IPAddress &p_address) :
29082905
memnew_placement(_data._mem, String(p_address));
29092906
}
29102907

2911-
Variant::Variant(const Variant &p_variant) :
2912-
type(NIL) {
2908+
Variant::Variant(const Variant &p_variant) {
29132909
reference(p_variant);
29142910
}
29152911

core/variant/variant.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,7 @@ class Variant {
814814
static void unregister_types();
815815

816816
Variant(const Variant &p_variant);
817-
_FORCE_INLINE_ Variant() :
818-
type(NIL) {}
817+
_FORCE_INLINE_ Variant() {}
819818
_FORCE_INLINE_ ~Variant() {
820819
clear();
821820
}

drivers/gles3/storage/particles_storage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ class ParticlesStorage : public RendererParticlesStorage {
396396

397397
_FORCE_INLINE_ bool particles_has_collision(RID p_particles) {
398398
Particles *particles = particles_owner.get_or_null(p_particles);
399-
ERR_FAIL_NULL_V(particles, 0);
399+
ERR_FAIL_NULL_V(particles, false);
400400

401401
return particles->has_collision_cache;
402402
}

drivers/vulkan/rendering_device_driver_vulkan.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ RDD::BufferID RenderingDeviceDriverVulkan::buffer_create(uint64_t p_size, BitFie
15191519
ERR_FAIL_COND_V_MSG(err, BufferID(), "Can't create buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
15201520
err = vmaAllocateMemoryForBuffer(allocator, vk_buffer, &alloc_create_info, &allocation, &alloc_info);
15211521
ERR_FAIL_COND_V_MSG(err, BufferID(), "Can't allocate memory for buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
1522-
err = vmaBindBufferMemory2(allocator, allocation, 0, vk_buffer, NULL);
1522+
err = vmaBindBufferMemory2(allocator, allocation, 0, vk_buffer, nullptr);
15231523
ERR_FAIL_COND_V_MSG(err, BufferID(), "Can't bind memory to buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
15241524

15251525
// Bookkeep.
@@ -1745,7 +1745,7 @@ RDD::TextureID RenderingDeviceDriverVulkan::texture_create(const TextureFormat &
17451745
ERR_FAIL_COND_V_MSG(err, TextureID(), "vkCreateImage failed with error " + itos(err) + ".");
17461746
err = vmaAllocateMemoryForImage(allocator, vk_image, &alloc_create_info, &allocation, &alloc_info);
17471747
ERR_FAIL_COND_V_MSG(err, TextureID(), "Can't allocate memory for image, error: " + itos(err) + ".");
1748-
err = vmaBindImageMemory2(allocator, allocation, 0, vk_image, NULL);
1748+
err = vmaBindImageMemory2(allocator, allocation, 0, vk_image, nullptr);
17491749
ERR_FAIL_COND_V_MSG(err, TextureID(), "Can't bind memory to image, error: " + itos(err) + ".");
17501750

17511751
// Create view.
@@ -4042,7 +4042,7 @@ RDD::UniformSetID RenderingDeviceDriverVulkan::uniform_set_create(VectorView<Bou
40424042
}
40434043

40444044
// Need a descriptor pool.
4045-
DescriptorSetPools::Iterator pool_sets_it = {};
4045+
DescriptorSetPools::Iterator pool_sets_it;
40464046
VkDescriptorPool vk_pool = _descriptor_set_pool_find_or_create(pool_key, &pool_sets_it);
40474047
DEV_ASSERT(vk_pool);
40484048
pool_sets_it->value[vk_pool]++;

drivers/vulkan/rendering_device_driver_vulkan.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ class RenderingDeviceDriverVulkan : public RenderingDeviceDriver {
489489
struct UniformSetInfo {
490490
VkDescriptorSet vk_descriptor_set = VK_NULL_HANDLE;
491491
VkDescriptorPool vk_descriptor_pool = VK_NULL_HANDLE;
492-
DescriptorSetPools::Iterator pool_sets_it = {};
492+
DescriptorSetPools::Iterator pool_sets_it;
493493
};
494494

495495
public:

0 commit comments

Comments
 (0)