Add Unreal Engine 5 specific ignores, raises, docs and tests for C/C++ (#1564)

This commit is contained in:
PETRO YAKOVYSHYN authored and GitHub committed 2026-06-25 11:23:25 +02:00
1 parent 5d44d017c8
commit 3975a91bfe
54 files changed
+1193 -12

No files matched your search

@@ -0,0 +1,9 @@
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
// Test stub: trimmed to what the fixture needs.
// DECLARE_FUNCTION(execOnAbilityInput)
#pragma once
class AAbilityActor;
@@ -0,0 +1,22 @@
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
// Test stub: repeats the hand-written identifiers (as real thunks do) so a
// text search would surface this file; symbol-level tools must not.
//
// void UAbilityComponent::execTriggerAbility(...) { TriggerAbility(AbilityName); }
// void UAbilityComponent::execGetRemainingCooldown(...) { GetRemainingCooldown(AbilityName); }
// void AAbilityActor::execOnAbilityInput(...) { OnAbilityInput(AbilityName); }
namespace UnrealReflectionStub
{
const char* GeneratedSymbols[] = {
"UAbilityComponent",
"TriggerAbility",
"GetRemainingCooldown",
"AAbilityActor",
"OnAbilityInput",
"FAbilityInfo",
};
}
@@ -0,0 +1,10 @@
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
// Test stub: trimmed to what the fixture needs.
// DECLARE_FUNCTION(execTriggerAbility)
// DECLARE_FUNCTION(execGetRemainingCooldown)
#pragma once
class UAbilityComponent;
@@ -0,0 +1,8 @@
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
// Test stub: trimmed to what the fixture needs.
#pragma once
struct FAbilityInfo;
@@ -0,0 +1,10 @@
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
// Test stub: trimmed to what the fixture needs.
// DECLARE_FUNCTION(execReceiveDamage)
#pragma once
class UDamageable;
class IDamageable;
@@ -0,0 +1,10 @@
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
// Test stub: trimmed to what the fixture needs.
// DECLARE_FUNCTION(execHeal)
// DECLARE_FUNCTION(execReceiveDamage)
#pragma once
class AGameCharacter;
@@ -0,0 +1,4 @@
{
"FileVersion": 3,
"EngineAssociation": "5.7"
}
@@ -0,0 +1,18 @@
#include "AbilityActor.h"
void AAbilityActor::BeginPlay()
{
AActor::BeginPlay();
if (AbilityComponent)
{
AbilityComponent->TriggerAbility(FName("Dash"));
}
}
void AAbilityActor::OnAbilityInput(const FName& AbilityName)
{
if (AbilityComponent)
{
AbilityComponent->TriggerAbility(AbilityName);
}
}
@@ -0,0 +1,24 @@
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "AbilityComponent.h"
#include "AbilityActor.generated.h"
UCLASS(Blueprintable)
class TESTGAME_API AAbilityActor : public AActor
{
GENERATED_BODY()
public:
virtual void BeginPlay() override;
UFUNCTION(BlueprintCallable, Category = "Input")
void OnAbilityInput(const FName& AbilityName);
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Components")
TObjectPtr<UAbilityComponent> AbilityComponent = nullptr;
UPROPERTY(EditDefaultsOnly, Category = "Abilities")
TSubclassOf<UAbilityComponent> ComponentClass;
};
@@ -0,0 +1,16 @@
#include "AbilityComponent.h"
void UAbilityComponent::TriggerAbility(const FName& AbilityName)
{
if (!ActiveCooldowns.Contains(AbilityName))
{
ActiveCooldowns.Add(AbilityName, 1.0f);
}
State = EAbilityState::Active;
OnAbilityTriggered.Broadcast(AbilityName);
}
float UAbilityComponent::GetRemainingCooldown(const FName& AbilityName) const
{
return 0.0f;
}
@@ -0,0 +1,40 @@
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "AbilityTypes.h"
#include "AbilityComponent.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAbilityTriggered, const FName&, AbilityName);
DECLARE_MULTICAST_DELEGATE_OneParam(FOnCooldownExpired, const FName&);
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class TESTGAME_API UAbilityComponent : public UActorComponent
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Abilities")
void TriggerAbility(const FName& AbilityName);
UFUNCTION(BlueprintPure, Category = "Abilities")
float GetRemainingCooldown(const FName& AbilityName) const;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Abilities")
TArray<FAbilityInfo> Abilities;
UPROPERTY(VisibleAnywhere, Category = "Abilities")
TMap<FName, float> ActiveCooldowns;
UPROPERTY(BlueprintAssignable, Category = "Abilities")
FOnAbilityTriggered OnAbilityTriggered;
UPROPERTY(EditAnywhere, Category = "Abilities")
EAbilityState State = EAbilityState::Idle;
UPROPERTY(EditAnywhere, Category = "Abilities")
TSet<FName> UnlockedAbilities;
// Non-dynamic delegates are not reflected and cannot be UPROPERTYs.
FOnCooldownExpired OnCooldownExpired;
};
@@ -0,0 +1,24 @@
#pragma once
#include "CoreMinimal.h"
#include "AbilityTypes.generated.h"
UENUM(BlueprintType)
enum class EAbilityState : uint8
{
Idle,
Active UMETA(DisplayName = "Active (in use)"),
Cooldown,
};
USTRUCT(BlueprintType)
struct TESTGAME_API FAbilityInfo
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FName AbilityName;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float CooldownSeconds = 1.0f;
};
@@ -0,0 +1,20 @@
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "Damageable.generated.h"
UINTERFACE(MinimalAPI, Blueprintable)
class UDamageable : public UInterface
{
GENERATED_BODY()
};
class TESTGAME_API IDamageable
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Damage")
virtual void ReceiveDamage(float Amount) = 0;
};
@@ -0,0 +1,29 @@
#include "GameCharacter.h"
#include "TestGameLog.h"
AGameCharacter::AGameCharacter()
{
Abilities = CreateDefaultSubobject<UAbilityComponent>(FName(TEXT("Abilities")));
}
void AGameCharacter::ReceiveDamage(float Amount)
{
check(Amount >= 0.0f);
Health -= Amount;
LastDamageAmount = Amount;
UE_LOG(LogTestGame, Warning, TEXT("Received %f damage"), Amount);
if (AActor* Target = CurrentTarget.Get())
{
if (AGameCharacter* OtherCharacter = Cast<AGameCharacter>(Target))
{
OtherCharacter->Heal(Amount);
}
}
}
void AGameCharacter::Heal(float& Amount)
{
Health += Amount;
Amount = 0.0f;
}
@@ -0,0 +1,39 @@
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "AbilityComponent.h"
#include "Damageable.h"
#include "GameCharacter.generated.h"
UCLASS(Blueprintable)
class TESTGAME_API AGameCharacter : public ACharacter, public IDamageable
{
GENERATED_BODY()
public:
AGameCharacter();
virtual void ReceiveDamage(float Amount) override;
UFUNCTION(BlueprintCallable, Category = "Health")
void Heal(UPARAM(ref) float& Amount);
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Spawn")
FVector SpawnOffset = FVector(0.0, 0.0, 100.0);
UPROPERTY(EditAnywhere, Category = "Abilities")
TObjectPtr<UAbilityComponent> Abilities;
UPROPERTY(VisibleAnywhere, Category = "Targeting")
TWeakObjectPtr<AActor> CurrentTarget;
UPROPERTY(EditAnywhere, Category = "Loadout")
TSoftObjectPtr<UAbilityComponent> FallbackLoadout;
private:
// Non-reflected runtime state: smart pointers and optionals are not UPROPERTYs.
TSharedPtr<FAbilityInfo> PendingAbility;
TOptional<float> LastDamageAmount;
float Health = 100.0f;
};
@@ -0,0 +1,5 @@
#pragma once
#include "CoreMinimal.h"
DECLARE_LOG_CATEGORY_EXTERN(LogTestGame, Log, All);
@@ -0,0 +1,6 @@
#include "TestGameLog.h"
#include "Modules/ModuleManager.h"
DEFINE_LOG_CATEGORY(LogTestGame)
IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, TestGame, "TestGame");
@@ -0,0 +1,10 @@
#pragma once
#include "UObject/Object.h"
class UActorComponent : public UObject
{
public:
virtual void BeginPlay() {}
virtual void TickComponent(float DeltaTime) {}
};
@@ -0,0 +1,11 @@
// Minimal TArray stand-in: just enough surface for the fixture sources to parse.
#pragma once
template <typename ElementType>
class TArray
{
public:
void Add(const ElementType& Item) {}
int Num() const { return 0; }
ElementType* GetData() { return nullptr; }
};
@@ -0,0 +1,12 @@
// Minimal TMap stand-in: just enough surface for the fixture sources to parse.
#pragma once
template <typename KeyType, typename ValueType>
class TMap
{
public:
ValueType& Add(const KeyType& Key, const ValueType& Value) { static ValueType V; return V; }
ValueType* Find(const KeyType& Key) { return nullptr; }
bool Contains(const KeyType& Key) const { return false; }
int Num() const { return 0; }
};
@@ -0,0 +1,11 @@
// Minimal TSet stand-in: just enough surface for the fixture sources to parse.
#pragma once
template <typename ElementType>
class TSet
{
public:
void Add(const ElementType& Item) {}
bool Contains(const ElementType& Item) const { return false; }
int Num() const { return 0; }
};
@@ -0,0 +1,20 @@
// Stand-in for Unreal's umbrella header.
#pragma once
#include "CoreTypes.h"
#include "Containers/Array.h"
#include "Containers/Map.h"
#include "Containers/Set.h"
#include "Delegates/DelegateCombinations.h"
#include "Logging/LogMacros.h"
#include "Math/MathFwd.h"
#include "Misc/Optional.h"
#include "Templates/SharedPointer.h"
#include "Templates/SubclassOf.h"
#include "Templates/UniquePtr.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "UObject/ObjectPtr.h"
#include "UObject/SoftObjectPtr.h"
#include "UObject/UObjectGlobals.h"
#include "UObject/WeakObjectPtr.h"
@@ -0,0 +1,41 @@
// Minimal stand-ins for core Unreal types and ubiquitous utility macros.
// Real homes in UE: TEXT/FORCEINLINE in Misc/, assertions in Misc/AssertionMacros.h,
// UE_DEPRECATED in Misc/CoreMiscDefines.h; folded together here for stub brevity.
#pragma once
class FName
{
public:
FName() = default;
FName(const char* InName) {}
bool operator==(const FName& Other) const { return true; }
bool operator<(const FName& Other) const { return false; }
};
class FString
{
public:
FString() = default;
FString(const char* InStr) {}
};
class FText
{
public:
FText() = default;
static FText FromString(const FString& InString) { return FText(); }
};
using int32 = int;
using uint32 = unsigned int;
using uint8 = unsigned char;
#define TEXT(x) x
#define FORCEINLINE inline
#define UE_DEPRECATED(Version, Message)
#define check(expr)
#define checkf(expr, format, ...)
#define verify(expr)
#define ensure(expr) (!!(expr))
#define ensureMsgf(expr, format, ...) (!!(expr))
@@ -0,0 +1,81 @@
// Stub of UE's delegate declaration macros (Delegates/DelegateCombinations.h).
// Unlike the empty annotation macros, these manufacture a class at the expansion
// site. The stubs preserve exactly that property for every delegate family:
// single-cast, multicast, events, and the dynamic (reflection-visible) variants.
#pragma once
#define DECLARE_DELEGATE(DelegateName) \
class DelegateName \
{ \
public: \
void Execute() {} \
bool IsBound() const { return false; } \
};
#define DECLARE_DELEGATE_OneParam(DelegateName, Param1Type) \
class DelegateName \
{ \
public: \
void Execute(Param1Type) {} \
bool IsBound() const { return false; } \
};
#define DECLARE_DELEGATE_RetVal(ReturnType, DelegateName) \
class DelegateName \
{ \
public: \
ReturnType Execute() { return ReturnType(); } \
bool IsBound() const { return false; } \
};
#define DECLARE_MULTICAST_DELEGATE(DelegateName) \
class DelegateName \
{ \
public: \
void Broadcast() {} \
};
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type) \
class DelegateName \
{ \
public: \
void Broadcast(Param1Type) {} \
};
#define DECLARE_EVENT(OwningType, EventName) \
class EventName \
{ \
public: \
void Broadcast() {} \
};
#define DECLARE_DYNAMIC_DELEGATE(DelegateName) \
class DelegateName \
{ \
public: \
void ExecuteIfBound() {} \
};
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE(DelegateName) \
class DelegateName \
{ \
public: \
void Broadcast() {} \
void AddDynamic(void* Object, void* Func) {} \
};
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name) \
class DelegateName \
{ \
public: \
void Broadcast(Param1Type Param1Name) {} \
void AddDynamic(void* Object, void* Func) {} \
};
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(DelegateName, Param1Type, Param1Name, Param2Type, Param2Name) \
class DelegateName \
{ \
public: \
void Broadcast(Param1Type Param1Name, Param2Type Param2Name) {} \
void AddDynamic(void* Object, void* Func) {} \
};
@@ -0,0 +1,9 @@
#pragma once
#include "UObject/Object.h"
class UWorld : public UObject
{
public:
float GetTimeSeconds() const { return 0.0f; }
};
@@ -0,0 +1,13 @@
#pragma once
#include "UObject/Object.h"
class UWorld;
class AActor : public UObject
{
public:
virtual void BeginPlay() {}
virtual void Tick(float DeltaSeconds) {}
UWorld* GetWorld() const { return nullptr; }
};
@@ -0,0 +1,9 @@
#pragma once
#include "GameFramework/Pawn.h"
class ACharacter : public APawn
{
public:
virtual void Jump() {}
};
@@ -0,0 +1,9 @@
#pragma once
#include "GameFramework/Actor.h"
class APawn : public AActor
{
public:
virtual void PossessedBy(AActor* NewController) {}
};
@@ -0,0 +1,13 @@
// Stub of UE's log category macros (Logging/LogMacros.h). The DECLARE/DEFINE pair
// manufactures a category object symbol; UE_LOG itself expands to nothing relevant.
#pragma once
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity) \
struct FLogCategory##CategoryName \
{ \
}; \
extern FLogCategory##CategoryName CategoryName;
#define DEFINE_LOG_CATEGORY(CategoryName) FLogCategory##CategoryName CategoryName;
#define UE_LOG(CategoryName, Verbosity, Format, ...)
@@ -0,0 +1,25 @@
// Minimal stand-ins for UE math types.
#pragma once
struct FVector
{
double X = 0.0;
double Y = 0.0;
double Z = 0.0;
FVector() = default;
FVector(double InX, double InY, double InZ) : X(InX), Y(InY), Z(InZ) {}
};
struct FRotator
{
double Pitch = 0.0;
double Yaw = 0.0;
double Roll = 0.0;
};
struct FTransform
{
FVector GetLocation() const { return FVector(); }
FRotator Rotator() const { return FRotator(); }
};
@@ -0,0 +1,12 @@
// Minimal TOptional stand-in.
#pragma once
template <typename T>
class TOptional
{
public:
TOptional() = default;
TOptional(const T& InValue) {}
bool IsSet() const { return false; }
const T& GetValue() const { static T Value; return Value; }
};
@@ -0,0 +1,9 @@
// Stub of UE's module boilerplate macros (Modules/ModuleManager.h).
#pragma once
class FDefaultGameModuleImpl
{
};
#define IMPLEMENT_PRIMARY_GAME_MODULE(ModuleImplClass, ModuleName, GameName)
#define IMPLEMENT_MODULE(ModuleImplClass, ModuleName)
@@ -0,0 +1,31 @@
// Minimal stand-ins for UE's non-UObject smart pointers.
#pragma once
template <typename T>
class TSharedPtr
{
public:
TSharedPtr() = default;
T* Get() const { return nullptr; }
bool IsValid() const { return false; }
};
template <typename T>
class TSharedRef
{
public:
T& Get() const { static T Instance; return Instance; }
};
template <typename T>
class TWeakPtr
{
public:
TSharedPtr<T> Pin() const { return TSharedPtr<T>(); }
};
template <typename T, typename... ArgTypes>
TSharedRef<T> MakeShared(ArgTypes&&... Args)
{
return TSharedRef<T>();
}
@@ -0,0 +1,9 @@
// Minimal TSubclassOf stand-in.
#pragma once
template <typename T>
class TSubclassOf
{
public:
TSubclassOf() = default;
};
@@ -0,0 +1,17 @@
// Minimal TUniquePtr stand-in.
#pragma once
template <typename T>
class TUniquePtr
{
public:
TUniquePtr() = default;
T* Get() const { return nullptr; }
bool IsValid() const { return false; }
};
template <typename T, typename... ArgTypes>
TUniquePtr<T> MakeUnique(ArgTypes&&... Args)
{
return TUniquePtr<T>();
}
@@ -0,0 +1,8 @@
#pragma once
#include "UObject/Object.h"
// Base class for the U-side of UE's interface pattern (UINTERFACE).
class UInterface : public UObject
{
};
@@ -0,0 +1,15 @@
#pragma once
#include "CoreTypes.h"
class UObject
{
public:
virtual ~UObject() = default;
template <typename T>
T* CreateDefaultSubobject(const FName& SubobjectName)
{
return nullptr;
}
};
@@ -0,0 +1,20 @@
// Stub mirroring Unreal Engine 5.7 ObjectMacros.h (Engine/Source/Runtime/CoreUObject/
// Public/UObject/ObjectMacros.h, lines 744-776). The annotation macros below are
// faithful: in real UE compilation they always expand to nothing (only UnrealHeaderTool
// parses their arguments). GENERATED_BODY is simplified: the real macro pastes
// declarations from the per-class *.generated.h via __LINE__ token concatenation.
#pragma once
#define UPROPERTY(...)
#define UFUNCTION(...)
#define UPARAM(...)
#define USTRUCT(...)
#define UMETA(...)
#define UENUM(...)
#define UCLASS(...)
#define UINTERFACE(...)
#define UDELEGATE(...)
#define GENERATED_BODY(...) public:
#define GENERATED_USTRUCT_BODY(...) public:
#define GENERATED_UCLASS_BODY(...) public:
@@ -0,0 +1,13 @@
// Minimal TObjectPtr stand-in (UE5's idiomatic UPROPERTY pointer wrapper).
#pragma once
template <typename T>
class TObjectPtr
{
public:
TObjectPtr() = default;
TObjectPtr(T* InPtr) {}
T* Get() const { return nullptr; }
T* operator->() const { return nullptr; }
explicit operator bool() const { return false; }
};
@@ -0,0 +1,18 @@
// Minimal stand-ins for UE's soft (lazy-loadable) object references.
#pragma once
template <typename T>
class TSoftObjectPtr
{
public:
TSoftObjectPtr() = default;
T* LoadSynchronous() const { return nullptr; }
bool IsValid() const { return false; }
};
template <typename T>
class TSoftClassPtr
{
public:
TSoftClassPtr() = default;
};
@@ -0,0 +1,16 @@
// Minimal stand-ins for UObject global helpers (Cast, NewObject).
#pragma once
class UObject;
template <typename T>
T* Cast(UObject* Object)
{
return nullptr;
}
template <typename T>
T* NewObject(UObject* Outer = nullptr)
{
return nullptr;
}
@@ -0,0 +1,12 @@
// Minimal TWeakObjectPtr stand-in.
#pragma once
template <typename T>
class TWeakObjectPtr
{
public:
TWeakObjectPtr() = default;
TWeakObjectPtr(T* InPtr) {}
T* Get() const { return nullptr; }
bool IsValid() const { return false; }
};
@@ -0,0 +1,22 @@
[
{
"directory": ".",
"command": "clang++ -std=c++20 -DTESTGAME_API= -I Stubs -I Source/TestGame -I Intermediate/TestGame/UHT -c Source/TestGame/AbilityComponent.cpp",
"file": "Source/TestGame/AbilityComponent.cpp"
},
{
"directory": ".",
"command": "clang++ -std=c++20 -DTESTGAME_API= -I Stubs -I Source/TestGame -I Intermediate/TestGame/UHT -c Source/TestGame/AbilityActor.cpp",
"file": "Source/TestGame/AbilityActor.cpp"
},
{
"directory": ".",
"command": "clang++ -std=c++20 -DTESTGAME_API= -I Stubs -I Source/TestGame -I Intermediate/TestGame/UHT -c Source/TestGame/GameCharacter.cpp",
"file": "Source/TestGame/GameCharacter.cpp"
},
{
"directory": ".",
"command": "clang++ -std=c++20 -DTESTGAME_API= -I Stubs -I Source/TestGame -I Intermediate/TestGame/UHT -c Source/TestGame/TestGameModule.cpp",
"file": "Source/TestGame/TestGameModule.cpp"
}
]