1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Port member initialization from constructor to declaration (C++11)

Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
This commit is contained in:
Rémi Verschelde
2020-05-12 17:01:17 +02:00
parent e7c9d81876
commit 1f6f364a56
325 changed files with 1689 additions and 3480 deletions

View File

@@ -43,6 +43,7 @@
#include "scene/main/node.h"
#include "modules/gdnative/gdnative.h"
#include <nativescript/godot_nativescript.h>
struct NativeScriptDesc {
@@ -54,6 +55,7 @@ struct NativeScriptDesc {
uint16_t rpc_method_id;
String documentation;
};
struct Property {
godot_property_set_func setter;
godot_property_get_func getter;
@@ -69,9 +71,9 @@ struct NativeScriptDesc {
String documentation;
};
uint16_t rpc_count;
uint16_t rpc_count = 0;
Map<StringName, Method> methods;
uint16_t rset_count;
uint16_t rset_count = 0;
OrderedHashMap<StringName, Property> properties;
Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
StringName base;
@@ -82,20 +84,11 @@ struct NativeScriptDesc {
String documentation;
const void *type_tag;
const void *type_tag = nullptr;
bool is_tool;
inline NativeScriptDesc() :
rpc_count(0),
methods(),
rset_count(0),
properties(),
signals_(),
base(),
base_native_type(),
documentation(),
type_tag(nullptr) {
inline NativeScriptDesc() {
zeromem(&create_func, sizeof(godot_instance_create_func));
zeromem(&destroy_func, sizeof(godot_instance_destroy_func));
}
@@ -396,14 +389,13 @@ inline NativeScriptDesc *NativeScript::get_script_desc() const {
class NativeReloadNode : public Node {
GDCLASS(NativeReloadNode, Node);
bool unloaded;
bool unloaded = false;
public:
static void _bind_methods();
void _notification(int p_what);
NativeReloadNode() :
unloaded(false) {}
NativeReloadNode() {}
};
class ResourceFormatLoaderNativeScript : public ResourceFormatLoader {