Skip to content

Commit 11cc8a4

Browse files
committed
Style: Begin integrating simple .clangd fixes
1 parent 2303ce8 commit 11cc8a4

Some content is hidden

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

71 files changed

+48
-117
lines changed

.clangd

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Diagnostics:
66
Includes:
77
IgnoreHeader:
8-
- core/typedefs\.h # Our "main" header, featuring transitive includes; allow everywhere.
98
- \.compat\.inc
109
---
1110
# Header-specific conditions.

core/error/error_macros.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "error_macros.h"
3232

3333
#include "core/io/logger.h"
34+
#include "core/object/object_id.h"
3435
#include "core/os/os.h"
3536
#include "core/string/ustring.h"
3637

core/error/error_macros.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030

3131
#pragma once
3232

33-
#include "core/object/object_id.h"
3433
#include "core/typedefs.h"
3534

36-
#include <atomic> // We'd normally use safe_refcount.h, but that would cause circular includes.
35+
#include <atomic> // IWYU pragma: keep // We'd normally use `safe_refcount.h`, but that would cause circular includes.
3736

3837
class String;
38+
class ObjectID;
3939

4040
enum ErrorHandlerType {
4141
ERR_HANDLER_ERROR,

core/io/image.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "image.h"
3232

3333
#include "core/config/project_settings.h"
34-
#include "core/error/error_list.h"
3534
#include "core/error/error_macros.h"
3635
#include "core/io/image_loader.h"
3736
#include "core/io/resource_loader.h"

core/math/bvh.h

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
// and pairable_mask is either 0 if static, or set to all if non static
5252

5353
#include "bvh_tree.h"
54+
55+
#include "core/math/geometry_3d.h"
5456
#include "core/os/mutex.h"
5557

5658
#define BVHTREE_CLASS BVH_Tree<T, NUM_TREES, 2, MAX_ITEMS, USER_PAIR_TEST_FUNCTION, USER_CULL_TEST_FUNCTION, USE_PAIRS, BOUNDS, POINT>

core/math/bvh_abb.h

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#pragma once
3232

33+
#include "core/math/aabb.h"
34+
3335
// special optimized version of axis aligned bounding box
3436
template <typename BOUNDS = AABB, typename POINT = Vector3>
3537
struct BVH_ABB {

core/math/bvh_tree.h

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
#include "core/math/aabb.h"
4242
#include "core/math/bvh_abb.h"
43-
#include "core/math/geometry_3d.h"
4443
#include "core/math/vector3.h"
4544
#include "core/templates/local_vector.h"
4645
#include "core/templates/pooled_list.h"

core/math/color_names.inc

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
// the old way leaked memory
3737
// this is not used as often as for more performance to make sense
3838

39+
#include "core/math/color.h"
40+
3941
struct NamedColor {
4042
const char *name;
4143
Color color;

core/math/delaunay_3d.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@
3030

3131
#pragma once
3232

33-
#include "core/io/file_access.h"
3433
#include "core/math/aabb.h"
3534
#include "core/math/projection.h"
3635
#include "core/math/vector3.h"
36+
#include "core/templates/list.h"
3737
#include "core/templates/local_vector.h"
3838
#include "core/templates/oa_hash_map.h"
3939
#include "core/templates/vector.h"
40-
#include "core/variant/variant.h"
4140

4241
#include "thirdparty/misc/r128.h"
4342

core/math/disjoint_set.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#pragma once
3232

33-
#include "core/templates/rb_map.h"
33+
#include "core/templates/hash_map.h"
3434
#include "core/templates/vector.h"
3535

3636
/* This DisjointSet class uses Find with path compression and Union by rank */

core/math/geometry_3d.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include "geometry_3d.h"
3232

33+
#include "core/templates/hash_map.h"
34+
3335
void Geometry3D::get_closest_points_between_segments(const Vector3 &p_p0, const Vector3 &p_p1, const Vector3 &p_q0, const Vector3 &p_q1, Vector3 &r_ps, Vector3 &r_qt) {
3436
// Based on David Eberly's Computation of Distance Between Line Segments algorithm.
3537

core/math/geometry_3d.h

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
#include "core/math/delaunay_3d.h"
3434
#include "core/math/face3.h"
35-
#include "core/object/object.h"
3635
#include "core/templates/local_vector.h"
3736
#include "core/templates/vector.h"
3837

core/math/math_funcs.h

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
#include "core/math/random_pcg.h"
3636
#include "core/typedefs.h"
3737

38-
#include "thirdparty/misc/pcg.h"
39-
4038
#include <float.h>
4139
#include <math.h>
4240

core/math/quick_hull.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131
#include "quick_hull.h"
3232

33+
#include "core/templates/hash_map.h"
34+
#include "core/templates/hash_set.h"
35+
3336
uint32_t QuickHull::debug_stop_after = 0xFFFFFFFF;
3437

3538
Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_mesh) {

core/math/static_raycaster.h

+1-11
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,14 @@
3232

3333
#include "core/object/ref_counted.h"
3434

35-
#if !defined(__aligned)
36-
37-
#if defined(_WIN32) && defined(_MSC_VER)
38-
#define __aligned(...) __declspec(align(__VA_ARGS__))
39-
#else
40-
#define __aligned(...) __attribute__((aligned(__VA_ARGS__)))
41-
#endif
42-
43-
#endif
44-
4535
class StaticRaycaster : public RefCounted {
4636
GDCLASS(StaticRaycaster, RefCounted)
4737
protected:
4838
static StaticRaycaster *(*create_function)();
4939

5040
public:
5141
// Compatible with embree4 rays.
52-
struct __aligned(16) Ray {
42+
struct alignas(16) Ray {
5343
const static unsigned int INVALID_GEOMETRY_ID = ((unsigned int)-1); // from rtcore_common.h
5444

5545
/*! Default construction does nothing. */

core/object/make_virtuals.py

-2
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@ def run(target, source, env):
211211
212212
#include "core/object/script_instance.h"
213213
214-
#include <utility>
215-
216214
#ifdef TOOLS_ENABLED
217215
#define _GDVIRTUAL_TRACK(m_virtual, m_initialized)\\
218216
if (_get_extension()->reloadable) {\\

core/os/memory.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
#include "core/error/error_macros.h"
3434
#include "core/templates/safe_refcount.h"
3535

36-
#include <stddef.h>
3736
#include <cstring>
38-
#include <new>
37+
#include <new> // IWYU pragma: keep // `new` operators.
3938
#include <type_traits>
4039

4140
class Memory {

core/os/os.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "core/io/file_access.h"
3636
#include "core/io/json.h"
3737
#include "core/os/midi_driver.h"
38-
#include "core/version_generated.gen.h"
38+
#include "core/version.h"
3939

4040
#include <stdarg.h>
4141

core/os/semaphore.h

-3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@
3030

3131
#pragma once
3232

33-
#include <cstdint>
34-
3533
#ifdef THREADS_ENABLED
3634

37-
#include "core/error/error_list.h"
3835
#include "core/typedefs.h"
3936
#ifdef DEBUG_ENABLED
4037
#include "core/error/error_macros.h"

core/string/translation_po.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030

3131
#include "translation_po.h"
3232

33+
#ifdef DEBUG_TRANSLATION_PO
3334
#include "core/io/file_access.h"
3435

35-
#ifdef DEBUG_TRANSLATION_PO
3636
void TranslationPO::print_translation_map() {
3737
Error err;
3838
Ref<FileAccess> file = FileAccess::open("translation_map_print_test.txt", FileAccess::WRITE, &err);

core/string/ustring.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "core/string/translation_server.h"
4040
#include "core/string/ucaps.h"
4141
#include "core/variant/variant.h"
42-
#include "core/version_generated.gen.h"
42+
#include "core/version.h"
4343

4444
#ifdef _MSC_VER
4545
#define _CRT_SECURE_NO_WARNINGS // to disable build-time warning which suggested to use strcpy_s instead strcpy

core/string/ustring.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
// Note: _GODOT suffix added to header guard to avoid conflict with ICU header.
3434

35-
#include "core/string/char_utils.h"
35+
#include "core/string/char_utils.h" // IWYU pragma: export
3636
#include "core/templates/cowdata.h"
3737
#include "core/templates/vector.h"
3838
#include "core/typedefs.h"

core/templates/cowdata.h

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <string.h>
3939
#include <initializer_list>
4040
#include <type_traits>
41-
#include <utility>
4241

4342
template <typename T>
4443
class Vector;

core/templates/hash_set.h

-3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@
3030

3131
#pragma once
3232

33-
#include "core/math/math_funcs.h"
3433
#include "core/os/memory.h"
35-
#include "core/templates/hash_map.h"
3634
#include "core/templates/hashfuncs.h"
37-
#include "core/templates/paged_allocator.h"
3835

3936
/**
4037
* Implementation of Set using a bidi indexed hash map.

core/templates/local_vector.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class LocalVector {
277277
}
278278

279279
void sort() {
280-
sort_custom<_DefaultComparator<T>>();
280+
sort_custom<Comparator<T>>();
281281
}
282282

283283
void ordered_insert(T p_val) {

core/templates/lru.h

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#pragma once
3232

33-
#include "core/math/math_funcs.h"
3433
#include "hash_map.h"
3534
#include "list.h"
3635

core/templates/oa_hash_map.h

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#pragma once
3232

33-
#include "core/math/math_funcs.h"
3433
#include "core/os/memory.h"
3534
#include "core/templates/hashfuncs.h"
3635
#include "core/templates/pair.h"

core/templates/paged_allocator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "core/typedefs.h"
3838

3939
#include <type_traits>
40-
#include <typeinfo>
40+
#include <typeinfo> // IWYU pragma: keep // Used in macro.
4141

4242
template <typename T, bool thread_safe = false, uint32_t DEFAULT_PAGE_SIZE = 4096>
4343
class PagedAllocator {

core/templates/rid_owner.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "core/templates/safe_refcount.h"
3939

4040
#include <stdio.h>
41-
#include <typeinfo>
41+
#include <typeinfo> // IWYU pragma: keep // Used in macro.
4242

4343
#ifdef SANITIZERS_ENABLED
4444
#ifdef __has_feature

core/templates/safe_list.h

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <atomic>
3737
#include <functional>
3838
#include <initializer_list>
39-
#include <type_traits>
4039

4140
// Design goals for these classes:
4241
// - Accessing this list with an iterator will never result in a use-after free,

core/templates/safe_refcount.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#endif
3838

3939
#include <atomic>
40-
#include <type_traits>
40+
#include <type_traits> // IWYU pragma: keep // Used in macros.
4141

4242
// Design goals for these classes:
4343
// - No automatic conversions or arithmetic operators,

core/templates/search_array.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030

3131
#pragma once
3232

33-
#include <core/templates/sort_array.h>
33+
#include "core/typedefs.h"
3434

35-
template <typename T, typename Comparator = _DefaultComparator<T>>
35+
template <typename T, typename Comparator = Comparator<T>>
3636
class SearchArray {
3737
public:
3838
Comparator compare;

core/templates/sort_array.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,13 @@
3939
break; \
4040
}
4141

42-
template <typename T>
43-
struct _DefaultComparator {
44-
_FORCE_INLINE_ bool operator()(const T &a, const T &b) const { return (a < b); }
45-
};
46-
4742
#ifdef DEBUG_ENABLED
4843
#define SORT_ARRAY_VALIDATE_ENABLED true
4944
#else
5045
#define SORT_ARRAY_VALIDATE_ENABLED false
5146
#endif
5247

53-
template <typename T, typename Comparator = _DefaultComparator<T>, bool Validate = SORT_ARRAY_VALIDATE_ENABLED>
48+
template <typename T, typename Comparator = Comparator<T>, bool Validate = SORT_ARRAY_VALIDATE_ENABLED>
5449
class SortArray {
5550
enum {
5651
INTROSORT_THRESHOLD = 16

core/templates/vector.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,11 @@
3939
*/
4040

4141
#include "core/error/error_macros.h"
42-
#include "core/os/memory.h"
4342
#include "core/templates/cowdata.h"
4443
#include "core/templates/search_array.h"
4544
#include "core/templates/sort_array.h"
4645

47-
#include <climits>
4846
#include <initializer_list>
49-
#include <utility>
5047

5148
template <typename T>
5249
class VectorWriteProxy {
@@ -131,7 +128,7 @@ class Vector {
131128
_FORCE_INLINE_ bool has(const T &p_val) const { return find(p_val) != -1; }
132129

133130
void sort() {
134-
sort_custom<_DefaultComparator<T>>();
131+
sort_custom<Comparator<T>>();
135132
}
136133

137134
template <typename Comparator, bool Validate = SORT_ARRAY_VALIDATE_ENABLED, typename... Args>
@@ -147,7 +144,7 @@ class Vector {
147144
}
148145

149146
Size bsearch(const T &p_value, bool p_before) {
150-
return bsearch_custom<_DefaultComparator<T>>(p_value, p_before);
147+
return bsearch_custom<Comparator<T>>(p_value, p_before);
151148
}
152149

153150
template <typename Comparator, typename Value, typename... Args>

0 commit comments

Comments
 (0)