UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LinkerPlaceholderBase.inl
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6
8struct FObjectImport;
9template<class PlaceholderType> class TLinkerImportPlaceholder;
10
11/*******************************************************************************
12 * TLinkerImportPlaceholder<>
13 ******************************************************************************/
14
15//------------------------------------------------------------------------------
16template<class PlaceholderType>
18{
20 {
22 {
23 if (!ReplacementRedirector->HasAnyFlags(RF_LoadCompleted))
24 {
25 // we're in the midst of serializing this redirector
26 // somewhere up the stack, in some scenario like this:
27 //
28 // - ClassA and ClassC both depend on ClassB
29 // - ClassB has a redirector to ClassB_2
30 // - ClassB_2 depends on ClassC
31 //
32 // if ClassA is loaded first, it then goes to load ClassB, which
33 // seeks to serialize in its UObjectRedirector; before that's
34 // set it loads ClassB_2 and subsequently ClassC; ClassC ends up
35 // here, needing to use the ClassB redirector, but we haven't
36 // returned up the stack for it to be set yet... here we force
37 // it to finish preloading (like we do in VerifyImport):
42 }
43 }
44 ReplacementObj = ReplacementRedirector->DestinationObject;
45 }
46
48
49 int32 ReplacementCount = ResolvePropertyReferences(TypeCheckedReplacement);
50 ReplacementCount += ResolveScriptReferences(TypeCheckedReplacement);
51
52#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
54 ChildObjects.Empty();
55#endif//USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
56
57 ReplacementCount += DerivedFunctions.Num();
58 for (auto Entry : DerivedFunctions)
59 {
60 Entry->SetSuperStruct(TypeCheckedReplacement);
61 }
62 DerivedFunctions.Empty();
63
65
66 return ReplacementCount;
67}
68
69//------------------------------------------------------------------------------
70template<class PlaceholderType>
72{
73
75 (ReferencingProperties.Num() > 0) ||
76 (ReferencingScriptExpressions.Num() > 0) ||
78 ChildObjects.Num() > 0 ||
79#endif //USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
80 DerivedFunctions.Num() > 0;
81}
82
83//------------------------------------------------------------------------------
84template<class PlaceholderType>
86{
87#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
89 check(ThisAsObject != nullptr);
90
91 if (!ReferencingProperty.IsUObject())
92 {
94 {
95 check(ThisAsObject->GetOutermost() == PropertyLinker->LinkerRoot);
97 }
98 }
99 // if this check hits, then we're adding dependencies after we've
100 // already resolved the placeholder (it won't be resolved again)
102#endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
103
104 ReferencingProperties.Add(ReferencingProperty);
105}
106
107#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
108//------------------------------------------------------------------------------
109template<class PlaceholderType>
111{
112 ChildObjects.Push(Child);
113}
114#endif //USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
115
116//------------------------------------------------------------------------------
117template<class PlaceholderType>
122
123//------------------------------------------------------------------------------
124template<class PlaceholderType>
129
130//------------------------------------------------------------------------------
131template<class PlaceholderType>
133{
134#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
136#endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
137
138 ReferencingScriptExpressions.Add(ExpressionPtr);
139}
140
141//------------------------------------------------------------------------------
142template<class PlaceholderType>
144{
145 if constexpr (std::is_same_v<PlaceholderType, UClass> || std::is_same_v<PlaceholderType, UFunction>)
146 {
147 return SpecializedResolvePropertyReferences(ReplacementObj);
148 }
149 else
150 {
151#if !CHECK_PUREVIRTUALS
152 // requires template specialization (technically not "pure virtual"):
154#endif
155 }
156}
157
158//------------------------------------------------------------------------------
159template<class PlaceholderType>
161{
164
165 for (PlaceholderType** ScriptRefPtr : ReferencingScriptExpressions)
166 {
169 {
172 }
173 }
174
175 ReferencingScriptExpressions.Empty();
176 return ReplacementCount;
177}
#define check(expr)
Definition AssertionMacros.h:314
#define USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
Definition Build.h:398
bool GEventDrivenLoaderEnabled
Definition CoreGlobals.cpp:415
#define PURE_VIRTUAL(func,...)
Definition CoreMiscDefines.h:103
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define EVENT_DRIVEN_ASYNC_LOAD_ACTIVE_AT_RUNTIME
Definition Archive.h:57
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ RF_LoadCompleted
Object has been completely serialized by linkerload at least once. DO NOT USE THIS FLAG,...
Definition ObjectMacros.h:586
@ RF_NeedLoad
During load, indicates object needs loading.
Definition ObjectMacros.h:573
@ LOAD_DeferDependencyLoads
Do not load external (blueprint) dependencies (instead, track them for deferred loading)
Definition ObjectMacros.h:89
Definition Field.h:353
COREUOBJECT_API FLinkerLoad * GetLinker() const
Definition Field.cpp:554
Definition LinkerLoad.h:124
virtual FLinker * GetLinker() override
Definition LinkerLoad.h:629
Definition LinkerPlaceholderBase.h:99
virtual int32 ResolveAllPlaceholderReferences(UObject *ReplacementObj)
Definition LinkerPlaceholderBase.cpp:503
virtual UObject * GetPlaceholderAsUObject() bool IsMarkedResolved() const
virtual bool HasKnownReferences() const
Definition LinkerPlaceholderBase.cpp:497
Definition UnrealType.h:174
Definition LinkerPlaceholderBase.h:284
void AddDerivedFunction(UStruct *DerivedFunctionType)
Definition LinkerPlaceholderBase.inl:118
void AddReferencingProperty(FFieldVariant ReferencingProperty)
Definition LinkerPlaceholderBase.inl:85
virtual bool HasKnownReferences() const override
Definition LinkerPlaceholderBase.inl:71
void RemoveReferencingProperty(FFieldVariant ReferencingProperty)
Definition LinkerPlaceholderBase.inl:125
virtual int32 ResolveAllPlaceholderReferences(UObject *ReplacementObj) override
Definition LinkerPlaceholderBase.inl:17
void AddReferencingScriptExpr(PlaceholderType **ExpressionPtr)
Definition LinkerPlaceholderBase.inl:132
Definition UniqueLock.h:20
Definition ObjectRedirector.h:30
Definition Object.h:95
Definition Class.h:480
@ NullAllowed
Definition Object.h:62
Definition ObjectResource.h:444