IWYU cleanup done

This commit is contained in:
2026-04-08 03:26:22 -04:00
parent 39cc7cd14b
commit 15beb42d5f
6 changed files with 57 additions and 22 deletions

50
Docs/TASKS/IWYU.md Normal file
View File

@@ -0,0 +1,50 @@
Your job is to remove unnecessary include-files from a
single C++ source file in UE Wingman, and also, add missing
includes.
Remember: not all removals that compile are good according
to the principles of IWYU. A source file should include or
forward-define everything it uses, and should include
nothing that it doesn't. You will need to think seriously.
To test your work, you will need to do a build:
python3 build.py c++
followed by:
tools/clangd-query.py diagnostics <file>
Sometimes, clangd gets desynchronized. If clangd is
reporting an error on UCLASS or on GENERATED_BODY after a
successful build, then clangd is out of sync. In that case,
you will need to refresh clangd:
tools/clangd-query.py stop
Then you can try again with the diagnostics. If the testing
reveals a mistake, please fix it and then redo the testing.
Start by reading the head of TODO.txt, which lists the files
that need to be cleaned. Please clean up the first file on
the todo list, then remove that one file from the todo list.
Then you are done.
One special exception to IWYU: all unreal code should include
CoreMinimal.h, no matter what.
There is no need to run clangd before you begin. These
files are already clangd-clean.
Do not be chatty about it. Just begin, get it cleaned, and
then very concisely report your results. And once again: do
not forget the principle of IWYU: not all removals that
compile are good. If a file is using a symbol, it should
include it or forward-define it, not rely on transitive
includes. Remove what should be removed, add what should be
added.

View File

@@ -1,11 +1,8 @@
#include "WingComponent.h"
#include "WingTypes.h"
#include "WingUtils.h"
#include "WingBasics.h"
#include "Engine/Blueprint.h"
#include "Engine/SCS_Node.h"
#include "Engine/SimpleConstructionScript.h"
#include "Components/ActorComponent.h"
#include "Components/SceneComponent.h"
#include "GameFramework/Actor.h"
#include "Kismet2/BlueprintEditorUtils.h"

View File

@@ -1,28 +1,15 @@
#include "WingUtils.h"
#include "WingComponent.h"
#include "WingProperty.h"
#include "WingTypes.h"
#include "WingServer.h"
#include "WingBasics.h"
#include "WingTokenizer.h"
#include "PropertyHandle.h"
#include "Engine/Blueprint.h"
#include "Engine/MemberReference.h"
#include "Engine/World.h"
#include "Components/ActorComponent.h"
#include "Engine/SCS_Node.h"
#include "EdGraph/EdGraph.h"
#include "EdGraph/EdGraphNode.h"
#include "EdGraph/EdGraphPin.h"
#include "K2Node_EditablePinBase.h"
#include "EdGraph/EdGraphSchema.h"
#include "Kismet2/BlueprintEditorUtils.h"
#include "Kismet2/Kismet2NameValidators.h"
#include "Kismet2/KismetEditorUtilities.h"
#include "UObject/UObjectIterator.h"
#include "UObject/UnrealType.h"
#include "Misc/Paths.h"
#include "Misc/PackageName.h"
// Reparent validation
#include "Engine/LevelScriptActor.h"
@@ -36,7 +23,6 @@
// Material support
#include "Materials/Material.h"
#include "Materials/MaterialExpression.h"
#include "Materials/MaterialFunction.h"
#include "Materials/MaterialInstanceConstant.h"
#include "MaterialGraph/MaterialGraph.h"

View File

@@ -3,12 +3,14 @@
Usage:
python3 tools/clangd-query.py symbol <name>
python3 tools/clangd-query.py diagnostics <file>
python3 tools/clangd-query.py definition <file> <line> <col>
python3 tools/clangd-query.py references <file> <line> <col>
python3 tools/clangd-query.py stop
Commands:
symbol <name> Search for symbols by name across the project.
diagnostics <file> Report clangd diagnostics for a file.
definition <file> <line> <col> Find where a symbol is defined.
references <file> <line> <col> Find all references to a symbol.
stop Stop the background daemon.
@@ -22,15 +24,15 @@ Examples:
How it works:
The first invocation starts a background clangd daemon process. It loads
the project index from .vscode/.cache/clangd/index/ (shared with VS Code's
clangd). This takes ~10 seconds. Subsequent queries hit the warm daemon
and return in milliseconds.
the project through a dedicated .clangd-query compile-commands directory,
which gives it a separate clangd cache. This takes ~10 seconds.
Subsequent queries hit the warm daemon and return in milliseconds.
Clangd configuration (binary path, flags) is read from
Integration.code-workspace so it stays in sync with VS Code.
The daemon writes its PID to .clangd-query.pid and listens on a Unix
socket at .clangd-query.sock. Use 'stop' to shut it down, or just kill
The daemon writes its PID to .clangd-query/pid and listens on a Unix
socket at .clangd-query/sock. Use 'stop' to shut it down, or just kill
the PID. Starting a new daemon automatically kills any existing one.
"""