Style: Apply clang-tidy fixes

• `modernize-use-default-member-init` and `readability-redundant-member-init`
• Minor adjustments to `.clang-tidy` to improve syntax & remove redundancies
This commit is contained in:
Thaddeus Crews 2024-06-21 11:19:04 -05:00
parent 1bffd6c73b
commit 89a311205f
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
21 changed files with 37 additions and 47 deletions

View File

@ -1,14 +1,12 @@
---
Checks: >-
-*,
cppcoreguidelines-pro-type-member-init,
modernize-redundant-void-arg,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-nullptr,
readability-braces-around-statements,
readability-redundant-member-init
WarningsAsErrors: ''
Checks:
- -*
- cppcoreguidelines-pro-type-member-init
- modernize-redundant-void-arg
- modernize-use-bool-literals
- modernize-use-default-member-init
- modernize-use-nullptr
- readability-braces-around-statements
- readability-redundant-member-init
HeaderFileExtensions: ['', h, hh, hpp, hxx, inc, glsl]
ImplementationFileExtensions: [c, cc, cpp, cxx, m, mm, java]
HeaderFilterRegex: (core|doc|drivers|editor|main|modules|platform|scene|servers|tests)/
@ -19,4 +17,3 @@ CheckOptions:
modernize-use-bool-literals.IgnoreMacros: false
modernize-use-default-member-init.IgnoreMacros: false
modernize-use-default-member-init.UseAssignment: true
...

View File

@ -315,6 +315,4 @@ struct BuildIndexSequence<0, Is...> : IndexSequence<Is...> {};
#define ___gd_is_defined(val) ____gd_is_defined(__GDARG_PLACEHOLDER_##val)
#define GD_IS_DEFINED(x) ___gd_is_defined(x)
#define FORCE_SEMICOLON ;
#endif // TYPEDEFS_H

View File

@ -2719,8 +2719,7 @@ Variant::Variant(const Vector<Plane> &p_array) :
}
}
Variant::Variant(const Vector<Face3> &p_face_array) :
type(NIL) {
Variant::Variant(const Vector<Face3> &p_face_array) {
PackedVector3Array vertices;
int face_count = p_face_array.size();
vertices.resize(face_count * 3);
@ -2739,8 +2738,7 @@ Variant::Variant(const Vector<Face3> &p_face_array) :
*this = vertices;
}
Variant::Variant(const Vector<Variant> &p_array) :
type(NIL) {
Variant::Variant(const Vector<Variant> &p_array) {
Array arr;
arr.resize(p_array.size());
for (int i = 0; i < p_array.size(); i++) {
@ -2749,8 +2747,7 @@ Variant::Variant(const Vector<Variant> &p_array) :
*this = arr;
}
Variant::Variant(const Vector<StringName> &p_array) :
type(NIL) {
Variant::Variant(const Vector<StringName> &p_array) {
PackedStringArray v;
int len = p_array.size();
v.resize(len);
@ -2908,8 +2905,7 @@ Variant::Variant(const IPAddress &p_address) :
memnew_placement(_data._mem, String(p_address));
}
Variant::Variant(const Variant &p_variant) :
type(NIL) {
Variant::Variant(const Variant &p_variant) {
reference(p_variant);
}

View File

@ -814,8 +814,7 @@ public:
static void unregister_types();
Variant(const Variant &p_variant);
_FORCE_INLINE_ Variant() :
type(NIL) {}
_FORCE_INLINE_ Variant() {}
_FORCE_INLINE_ ~Variant() {
clear();
}

View File

@ -4017,7 +4017,7 @@ RDD::UniformSetID RenderingDeviceDriverVulkan::uniform_set_create(VectorView<Bou
}
// Need a descriptor pool.
DescriptorSetPools::Iterator pool_sets_it = {};
DescriptorSetPools::Iterator pool_sets_it;
VkDescriptorPool vk_pool = _descriptor_set_pool_find_or_create(pool_key, &pool_sets_it);
DEV_ASSERT(vk_pool);
pool_sets_it->value[vk_pool]++;

View File

@ -487,7 +487,7 @@ private:
struct UniformSetInfo {
VkDescriptorSet vk_descriptor_set = VK_NULL_HANDLE;
VkDescriptorPool vk_descriptor_pool = VK_NULL_HANDLE;
DescriptorSetPools::Iterator pool_sets_it = {};
DescriptorSetPools::Iterator pool_sets_it;
};
public:

View File

@ -789,7 +789,7 @@ public:
struct AdditiveNodeEntry {
Node *node = nullptr;
NodePath parent = NodePath();
NodePath parent;
Node *owner = nullptr;
int index = 0;
// Used if the original parent node is lost

View File

@ -649,8 +649,9 @@ QuickOpenDisplayMode QuickOpenResultContainer::get_adaptive_display_mode(const V
for (const StringName &type : grid_preferred_types) {
for (const StringName &base_type : p_base_types) {
if (base_type == type || ClassDB::is_parent_class(base_type, type))
if (base_type == type || ClassDB::is_parent_class(base_type, type)) {
return QuickOpenDisplayMode::GRID;
}
}
}

View File

@ -91,7 +91,7 @@ public:
TileSetAtlasSourceEditor *tiles_set_atlas_source_editor = nullptr;
Ref<TileSetAtlasSource> tile_set_atlas_source;
RBSet<TileSelection> tiles = RBSet<TileSelection>();
RBSet<TileSelection> tiles;
protected:
bool _set(const StringName &p_name, const Variant &p_value);

View File

@ -91,10 +91,10 @@ class BetsyCompressor : public Object {
RenderingDevice *compress_rd = nullptr;
RenderingContextDriver *compress_rcd = nullptr;
HashMap<String, BetsyShader> cached_shaders;
RID src_sampler = RID();
RID src_sampler;
// Format-specific resources.
RID dxt1_encoding_table_buffer = RID();
RID dxt1_encoding_table_buffer;
void _init();
void _assign_mt_ids(WorkerThreadPool::TaskID p_pump_task_id);

View File

@ -67,7 +67,7 @@ class NavAgent : public NavRid {
uint32_t avoidance_mask = 1;
real_t avoidance_priority = 1.0;
Callable avoidance_callback = Callable();
Callable avoidance_callback;
bool agent_dirty = true;

View File

@ -298,8 +298,7 @@ void OpenXRExtensionWrapperExtension::register_extension_wrapper() {
OpenXRAPI::register_extension_wrapper(this);
}
OpenXRExtensionWrapperExtension::OpenXRExtensionWrapperExtension() :
Object(), OpenXRExtensionWrapper() {
OpenXRExtensionWrapperExtension::OpenXRExtensionWrapperExtension() {
openxr_api.instantiate();
}

View File

@ -162,7 +162,7 @@ private:
Vector<int> parentless_bones;
AHashMap<String, int> name_to_bone_index;
mutable StringName concatenated_bone_names = StringName();
mutable StringName concatenated_bone_names;
void _update_bone_names() const;
void _make_dirty();

View File

@ -131,7 +131,7 @@ class SkeletonIK3D : public SkeletonModifier3D {
real_t min_distance = 0.01;
int max_iterations = 10;
Variant target_node_override_ref = Variant();
Variant target_node_override_ref;
FabrikInverseKinematic::Task *task = nullptr;
#ifndef DISABLE_DEPRECATED

View File

@ -251,13 +251,13 @@ private:
Ref<Texture2D> completion_color_bg;
Color breakpoint_color = Color(1, 1, 1);
Ref<Texture2D> breakpoint_icon = Ref<Texture2D>();
Ref<Texture2D> breakpoint_icon;
Color bookmark_color = Color(1, 1, 1);
Ref<Texture2D> bookmark_icon = Ref<Texture2D>();
Ref<Texture2D> bookmark_icon;
Color executing_line_color = Color(1, 1, 1);
Ref<Texture2D> executing_line_icon = Ref<Texture2D>();
Ref<Texture2D> executing_line_icon;
Color line_number_color = Color(1, 1, 1);

View File

@ -139,7 +139,7 @@ private:
Variant metadata;
bool clickable = false;
Ref<Texture2D> icon = Ref<Texture2D>();
Ref<Texture2D> icon;
String text = "";
Color color = Color(1, 1, 1);
};

View File

@ -64,7 +64,7 @@ public:
execution_mode_physics_process
};
Vector<Ref<SkeletonModification2D>> modifications = Vector<Ref<SkeletonModification2D>>();
Vector<Ref<SkeletonModification2D>> modifications;
void setup();
void execute(float p_delta, int p_execution_mode);

View File

@ -836,7 +836,7 @@ private:
bool flip_v = false;
bool transpose = false;
Vector2i texture_origin;
Ref<Material> material = Ref<Material>();
Ref<Material> material;
Color modulate = Color(1.0, 1.0, 1.0, 1.0);
int z_index = 0;
int y_sort_origin = 0;

View File

@ -102,9 +102,9 @@ private:
/* Canvas Texture API */
struct CanvasTextureCache {
RID diffuse = RID();
RID normal = RID();
RID specular = RID();
RID diffuse;
RID normal;
RID specular;
};
class CanvasTexture {

View File

@ -1213,7 +1213,7 @@ public:
struct ShaderCompileInfo {
HashMap<StringName, FunctionInfo> functions;
Vector<ModeInfo> render_modes;
VaryingFunctionNames varying_function_names = VaryingFunctionNames();
VaryingFunctionNames varying_function_names;
HashSet<String> shader_types;
GlobalShaderUniformGetTypeFunc global_shader_uniform_type_func = nullptr;
bool is_include = false;

View File

@ -49,7 +49,7 @@ public:
}
unsigned function1_calls{ 0 };
Variant function1_latest_arg0{};
Variant function1_latest_arg0;
};
static inline Array build_array() {