Skip to content

Remove unused includes in servers with clangd-tidy#117295

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
akien-mga:clangd-unused-includes-servers
Mar 11, 2026
Merged

Remove unused includes in servers with clangd-tidy#117295
Repiteo merged 1 commit into
godotengine:masterfrom
akien-mga:clangd-unused-includes-servers

Conversation

@akien-mga

@akien-mga akien-mga commented Mar 10, 2026

Copy link
Copy Markdown
Member
@akien-mga akien-mga added this to the 4.x milestone Mar 10, 2026
@akien-mga akien-mga requested review from a team as code owners March 10, 2026 16:46
@akien-mga akien-mga requested review from a team as code owners March 10, 2026 16:46
@@ -35,7 +35,7 @@
#include "core/config/project_settings.h"
#include "core/object/callable_mp.h"
#include "core/object/class_db.h"
#include "scene/main/node.h"
#include "scene/main/node.h" // IWYU pragma: keep. Needed to bind `Node *` arg.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, the error when removing this:
https://pastebin.com/0PmHNDiA

#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h"
#include "scene/resources/2d/navigation_polygon.h"
#include "servers/navigation_2d/navigation_path_query_parameters_2d.h"
#include "servers/navigation_2d/navigation_path_query_result_2d.h"

class Node;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added for clarity, it's already forward-declared through other includes but since it's used explicitly, it's a prime candidate for a compile error in the future as we clean stuff up.

Comment on lines +33 to +36
#include "core/math/aabb.h"
#include "core/math/transform_3d.h"
#include "core/math/vector3i.h"
#include "core/templates/rid.h"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So these being missing didn't cause compiler errors for some reason, but clangd flags that it's a problem for them to be forward-declared here.

They're used explicitly as return values of methods declared here (e.g. virtual RID voxel_gi_allocate() override { return RID(); }) so it seems logical for the full type to be required.

I guess it's not a compile error currently because we just happen to include this file only in servers/rendering/dummy/rasterizer_dummy.cpp which itself probably has these types fully defined.

@Repiteo Repiteo removed request for a team March 10, 2026 19:30
@Repiteo Repiteo removed request for a team March 10, 2026 19:30
@akien-mga akien-mga force-pushed the clangd-unused-includes-servers branch from 5dbcd0b to f1d6327 Compare March 10, 2026 20:42
@akien-mga akien-mga modified the milestones: 4.x, 4.7 Mar 10, 2026
@Repiteo Repiteo merged commit 847d684 into godotengine:master Mar 11, 2026
20 checks passed
@Repiteo

Repiteo commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment