Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compilation time with include-what-you-use (core folder) #57760

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion core/config/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@
#include "engine.h"

#include "core/authors.gen.h"
#include "core/config/project_settings.h"
#include "core/donors.gen.h"
#include "core/error/error_macros.h"
#include "core/license.gen.h"
#include "core/object/object.h"
#include "core/object/ref_counted.h"
#include "core/string/print_string.h"
#include "core/variant/variant.h"
#include "core/version.h"
#include "core/version_generated.gen.h"
#include "core/version_hash.gen.h"

void Engine::set_physics_ticks_per_second(int p_ips) {
Expand Down
9 changes: 9 additions & 0 deletions core/config/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,19 @@
#ifndef ENGINE_H
#define ENGINE_H

#include <stdint.h>

#include "core/os/main_loop.h"
#include "core/string/string_name.h"
#include "core/string/ustring.h"
#include "core/templates/list.h"
#include "core/templates/map.h"
#include "core/templates/vector.h"
#include "core/typedefs.h"
#include "core/variant/array.h"
#include "core/variant/dictionary.h"

class Object;

class Engine {
public:
Expand Down
15 changes: 11 additions & 4 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,27 @@

#include "project_settings.h"

#include "core/core_bind.h" // For Compression enum.
#include "core/config/engine.h"
#include "core/core_string_names.h"
#include "core/error/error_macros.h"
#include "core/input/input_event.h"
#include "core/input/input_map.h"
#include "core/io/compression.h"
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/io/file_access_network.h"
#include "core/io/file_access_pack.h"
#include "core/io/marshalls.h"
#include "core/os/keyboard.h"
#include "core/object/class_db.h"
#include "core/object/ref_counted.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/templates/pair.h"
#include "core/variant/array.h"
#include "core/variant/dictionary.h"
#include "core/variant/variant_parser.h"
#include "core/version.h"

#include "modules/modules_enabled.gen.h" // For mono.
#include "core/version_generated.gen.h"

const String ProjectSettings::PROJECT_DATA_DIR_NAME_SUFFIX = "godot";

Expand Down
13 changes: 13 additions & 0 deletions core/config/project_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,23 @@
#ifndef PROJECT_SETTINGS_H
#define PROJECT_SETTINGS_H

#include <stdint.h>

#include "core/error/error_list.h"
#include "core/object/class_db.h"
#include "core/object/object.h"
#include "core/os/thread_safe.h"
#include "core/string/string_name.h"
#include "core/string/ustring.h"
#include "core/templates/list.h"
#include "core/templates/map.h"
#include "core/templates/ordered_hash_map.h"
#include "core/templates/set.h"
#include "core/templates/vector.h"
#include "core/typedefs.h"
#include "core/variant/variant.h"

class Dictionary;

class ProjectSettings : public Object {
GDCLASS(ProjectSettings, Object);
Expand Down
22 changes: 22 additions & 0 deletions core/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,38 @@

#include "core_bind.h"

#include <stddef.h>
#include <initializer_list>

#include "core/config/engine.h"
#include "core/config/project_settings.h"
#include "core/crypto/crypto_core.h"
#include "core/debugger/engine_debugger.h"
#include "core/error/error_macros.h"
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/io/file_access_compressed.h"
#include "core/io/file_access_encrypted.h"
#include "core/io/image.h"
#include "core/io/marshalls.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/math/geometry_2d.h"
#include "core/math/geometry_3d.h"
#include "core/math/vector2i.h"
#include "core/object/class_db.h"
#include "core/object/method_bind.h"
#include "core/object/object_id.h"
#include "core/object/script_language.h"
#include "core/os/keyboard.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
#include "core/templates/list.h"
#include "core/templates/pair.h"
#include "core/typedefs.h"

struct Plane;

namespace core_bind {

Expand Down
24 changes: 24 additions & 0 deletions core/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,42 @@
#ifndef CORE_BIND_H
#define CORE_BIND_H

#include <stdint.h>

#include "core/error/error_list.h"
#include "core/io/compression.h"
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/io/image.h"
#include "core/io/resource.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/io/resource_uid.h"
#include "core/math/math_defs.h"
#include "core/math/vector2.h"
#include "core/math/vector3.h"
#include "core/object/object.h"
#include "core/object/ref_counted.h"
#include "core/os/keyboard.h"
#include "core/os/mutex.h"
#include "core/os/os.h"
#include "core/os/semaphore.h"
#include "core/os/thread.h"
#include "core/string/string_name.h"
#include "core/string/ustring.h"
#include "core/templates/map.h"
#include "core/templates/safe_refcount.h"
#include "core/templates/vector.h"
#include "core/variant/array.h"
#include "core/variant/binder_common.h"
#include "core/variant/callable.h"
#include "core/variant/dictionary.h"
#include "core/variant/variant.h"

class MainLoop;
class DirAccess;
class FileAccess;
struct Plane;

namespace core_bind {

Expand Down
10 changes: 8 additions & 2 deletions core/core_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@

#include "core_constants.h"

#include "core/input/input_event.h"
#include "core/error/error_list.h"
#include "core/input/input_enums.h"
#include "core/math/math_defs.h"
#include "core/multiplayer/multiplayer.h"
#include "core/object/class_db.h"
#include "core/object/method_bind.h"
#include "core/object/object.h"
#include "core/os/keyboard.h"
#include "core/templates/vector.h"
#include "core/typedefs.h"
#include "core/variant/type_info.h"
#include "core/variant/variant.h"

struct _CoreConstant {
Expand Down
2 changes: 2 additions & 0 deletions core/core_string_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#ifndef CORE_STRING_NAMES_H
#define CORE_STRING_NAMES_H

#include "core/os/memory.h"
#include "core/string/string_name.h"
#include "core/typedefs.h"

class CoreStringNames {
friend void register_core_types();
Expand Down
5 changes: 5 additions & 0 deletions core/crypto/aes_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@

#include "core/crypto/aes_context.h"

#include <stdint.h>

#include "core/error/error_macros.h"
#include "core/object/class_db.h"

Error AESContext::start(Mode p_mode, PackedByteArray p_key, PackedByteArray p_iv) {
ERR_FAIL_COND_V_MSG(mode != MODE_MAX, ERR_ALREADY_IN_USE, "AESContext already started. Call 'finish' before starting a new one.");
ERR_FAIL_COND_V_MSG(p_mode < 0 || p_mode >= MODE_MAX, ERR_INVALID_PARAMETER, "Invalid mode requested.");
Expand Down
4 changes: 4 additions & 0 deletions core/crypto/aes_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
#define AES_CONTEXT_H

#include "core/crypto/crypto_core.h"
#include "core/error/error_list.h"
#include "core/object/object.h"
#include "core/object/ref_counted.h"
#include "core/variant/binder_common.h"
#include "core/variant/variant.h"

class AESContext : public RefCounted {
GDCLASS(AESContext, RefCounted);
Expand Down
5 changes: 2 additions & 3 deletions core/crypto/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@

#include "crypto.h"

#include "core/config/engine.h"
#include "core/io/certs_compressed.gen.h"
#include "core/io/compression.h"
#include "core/error/error_macros.h"
#include "core/object/class_db.h"

/// Resources

Expand Down
8 changes: 8 additions & 0 deletions core/crypto/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,19 @@
#ifndef CRYPTO_H
#define CRYPTO_H

#include <stdint.h>

#include "core/crypto/hashing_context.h"
#include "core/error/error_list.h"
#include "core/io/resource.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/object/object.h"
#include "core/object/ref_counted.h"
#include "core/string/ustring.h"
#include "core/templates/list.h"
#include "core/templates/vector.h"
#include "core/variant/variant.h"

class CryptoKey : public Resource {
GDCLASS(CryptoKey, Resource);
Expand Down
3 changes: 3 additions & 0 deletions core/crypto/crypto_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#include <mbedtls/sha1.h>
#include <mbedtls/sha256.h>

#include "core/os/memory.h"
#include "core/templates/vector.h"

// MD5
CryptoCore::MD5Context::MD5Context() {
ctx = memalloc(sizeof(mbedtls_md5_context));
Expand Down
5 changes: 5 additions & 0 deletions core/crypto/crypto_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
#ifndef CRYPTO_CORE_H
#define CRYPTO_CORE_H

#include <stddef.h>
#include <stdint.h>

#include "core/error/error_list.h"
#include "core/object/ref_counted.h"
#include "core/string/ustring.h"

class CryptoCore {
public:
Expand Down
6 changes: 6 additions & 0 deletions core/crypto/hashing_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@

#include "hashing_context.h"

#include <stddef.h>
#include <stdint.h>

#include "core/crypto/crypto_core.h"
#include "core/error/error_macros.h"
#include "core/object/class_db.h"
#include "core/os/memory.h"

Error HashingContext::start(HashType p_type) {
ERR_FAIL_COND_V(ctx != nullptr, ERR_ALREADY_IN_USE);
Expand Down
4 changes: 4 additions & 0 deletions core/crypto/hashing_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
#ifndef HASHING_CONTEXT_H
#define HASHING_CONTEXT_H

#include "core/error/error_list.h"
#include "core/object/object.h"
#include "core/object/ref_counted.h"
#include "core/variant/binder_common.h"
#include "core/variant/variant.h"

class HashingContext : public RefCounted {
GDCLASS(HashingContext, RefCounted);
Expand Down
2 changes: 2 additions & 0 deletions core/debugger/debugger_marshalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#include "debugger_marshalls.h"

#include "core/error/error_list.h"
#include "core/error/error_macros.h"
#include "core/io/marshalls.h"

#define CHECK_SIZE(arr, expected, what) ERR_FAIL_COND_V_MSG((uint32_t)arr.size() < (uint32_t)(expected), false, String("Malformed ") + what + " message from script debugger, message too short. Expected size: " + itos(expected) + ", actual size: " + itos(arr.size()))
Expand Down
10 changes: 10 additions & 0 deletions core/debugger/debugger_marshalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@
#ifndef DEBUGGER_MARSHARLLS_H
#define DEBUGGER_MARSHARLLS_H

#include <stdint.h>

#include "core/object/object_id.h"
#include "core/object/script_language.h"
#include "core/string/string_name.h"
#include "core/string/ustring.h"
#include "core/templates/list.h"
#include "core/templates/rid.h"
#include "core/templates/vector.h"
#include "core/variant/array.h"
#include "core/variant/variant.h"
#include "servers/rendering_server.h"

struct DebuggerMarshalls {
Expand Down
4 changes: 4 additions & 0 deletions core/debugger/engine_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
#include "core/debugger/remote_debugger.h"
#include "core/debugger/remote_debugger_peer.h"
#include "core/debugger/script_debugger.h"
#include "core/math/math_defs.h"
#include "core/object/ref_counted.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/templates/pair.h"

EngineDebugger *EngineDebugger::singleton = nullptr;
ScriptDebugger *EngineDebugger::script_debugger = nullptr;
Expand Down
5 changes: 5 additions & 0 deletions core/debugger/engine_debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@
#ifndef ENGINE_DEBUGGER_H
#define ENGINE_DEBUGGER_H

#include <stdint.h>

#include "core/error/error_list.h"
#include "core/error/error_macros.h"
#include "core/string/string_name.h"
#include "core/string/ustring.h"
#include "core/templates/map.h"
#include "core/templates/vector.h"
#include "core/typedefs.h"
#include "core/variant/array.h"
#include "core/variant/variant.h"

Expand Down
14 changes: 14 additions & 0 deletions core/debugger/local_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,24 @@

#include "local_debugger.h"

#include <stdint.h>

#include "core/debugger/script_debugger.h"
#include "core/math/math_defs.h"
#include "core/object/script_language.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
#include "core/string/string_name.h"
#include "core/templates/set.h"
#include "core/templates/sort_array.h"
#include "core/templates/vector.h"
#include "core/typedefs.h"
#include "core/variant/variant.h"
#include "scene/main/scene_tree.h"

class Array;

struct LocalDebugger::ScriptsProfiler {
struct ProfileInfoSort {
bool operator()(const ScriptLanguage::ProfilingInfo &A, const ScriptLanguage::ProfilingInfo &B) const {
Expand Down
Loading