2019-12-26 23:06:02 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "CoreMinimal.h"
|
2021-05-26 09:54:27 -04:00
|
|
|
#include "Exceptions.h"
|
2021-04-14 18:40:45 -04:00
|
|
|
#include "GeneratedCodeVersion.h"
|
2021-05-19 07:42:12 -04:00
|
|
|
#include "ParserHelper.h"
|
|
|
|
|
#include "Containers/UnrealString.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
|
2021-04-14 18:40:45 -04:00
|
|
|
enum class EPointerMemberBehavior
|
|
|
|
|
{
|
|
|
|
|
Disallow,
|
|
|
|
|
AllowSilently,
|
|
|
|
|
AllowAndLog,
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-27 10:12:41 -04:00
|
|
|
enum class EUnderlyingEnumType
|
|
|
|
|
{
|
|
|
|
|
Unspecified,
|
|
|
|
|
uint8,
|
|
|
|
|
uint16,
|
|
|
|
|
uint32,
|
|
|
|
|
uint64,
|
|
|
|
|
int8,
|
|
|
|
|
int16,
|
|
|
|
|
int32,
|
|
|
|
|
int64
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-21 07:29:12 -04:00
|
|
|
using FMetaData = TMap<FName, FString>;
|
|
|
|
|
|
2021-04-14 18:40:45 -04:00
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// UHTConfig
|
|
|
|
|
|
|
|
|
|
struct FUHTConfig
|
|
|
|
|
{
|
|
|
|
|
static const FUHTConfig& Get();
|
|
|
|
|
|
|
|
|
|
// Types that have been renamed, treat the old deprecated name as the new name for code generation
|
|
|
|
|
TMap<FString, FString> TypeRedirectMap;
|
|
|
|
|
|
|
|
|
|
// Special parsed struct names that do not require a prefix
|
|
|
|
|
TArray<FString> StructsWithNoPrefix;
|
|
|
|
|
|
|
|
|
|
// Special parsed struct names that have a 'T' prefix
|
|
|
|
|
TArray<FString> StructsWithTPrefix;
|
|
|
|
|
|
|
|
|
|
// Mapping from 'human-readable' macro substring to # of parameters for delegate declarations
|
|
|
|
|
// Index 0 is 1 parameter, Index 1 is 2, etc...
|
|
|
|
|
TArray<FString> DelegateParameterCountStrings;
|
|
|
|
|
|
|
|
|
|
// Default version of generated code. Defaults to oldest possible, unless specified otherwise in config.
|
|
|
|
|
EGeneratedCodeVersion DefaultGeneratedCodeVersion = EGeneratedCodeVersion::V1;
|
|
|
|
|
|
2021-06-10 10:20:49 -04:00
|
|
|
EPointerMemberBehavior EngineNativePointerMemberBehavior = EPointerMemberBehavior::AllowSilently;
|
|
|
|
|
EPointerMemberBehavior EngineObjectPtrMemberBehavior = EPointerMemberBehavior::AllowSilently;
|
2021-04-14 18:40:45 -04:00
|
|
|
|
2021-06-10 10:20:49 -04:00
|
|
|
EPointerMemberBehavior NonEngineNativePointerMemberBehavior = EPointerMemberBehavior::AllowSilently;
|
|
|
|
|
EPointerMemberBehavior NonEngineObjectPtrMemberBehavior = EPointerMemberBehavior::AllowSilently;
|
2021-04-14 18:40:45 -04:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
FUHTConfig();
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-19 09:35:19 -04:00
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// Token types.
|
|
|
|
|
|
|
|
|
|
enum class ETokenType
|
|
|
|
|
{
|
|
|
|
|
None, // No token.
|
|
|
|
|
Identifier, // Alphanumeric identifier.
|
|
|
|
|
Symbol, // Symbol.
|
|
|
|
|
TrueConst, // True value via identifier
|
|
|
|
|
FalseConst, // False value via identifier
|
|
|
|
|
FloatConst, // Floating point constant
|
|
|
|
|
DecimalConst, // Decimal Integer constant
|
|
|
|
|
HexConst, // Hex integer constant
|
|
|
|
|
CharConst, // Single character constant
|
|
|
|
|
StringConst, // String constant
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Helper structure for strings. Only valid when called on a StringConst or CharConst.
|
|
|
|
|
// The surrounding quotes are removed and \n escape characters are processed.
|
|
|
|
|
struct FTokenString
|
|
|
|
|
{
|
|
|
|
|
TCHAR String[MAX_STRING_CONST_SIZE];
|
|
|
|
|
|
2021-11-07 23:43:01 -05:00
|
|
|
FTokenString()
|
|
|
|
|
{
|
|
|
|
|
String[0] = TEXT('\0');
|
|
|
|
|
}
|
2021-07-19 09:35:19 -04:00
|
|
|
|
|
|
|
|
const TCHAR* operator *() const
|
|
|
|
|
{
|
|
|
|
|
return String;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Helper structure for null terminated value. This will be the raw text from the token.
|
|
|
|
|
struct FTokenValue
|
|
|
|
|
{
|
2021-07-19 09:57:11 -04:00
|
|
|
TCHAR Value[NAME_SIZE];
|
2021-07-19 09:35:19 -04:00
|
|
|
|
2021-11-07 23:43:01 -05:00
|
|
|
FTokenValue()
|
|
|
|
|
{
|
|
|
|
|
Value[0] = TEXT('\0');
|
|
|
|
|
}
|
2021-07-19 09:35:19 -04:00
|
|
|
|
|
|
|
|
const TCHAR* operator *() const
|
|
|
|
|
{
|
|
|
|
|
return Value;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// FToken
|
|
|
|
|
|
|
|
|
|
class FToken
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/** Type of token. */
|
|
|
|
|
ETokenType TokenType = ETokenType::None;
|
|
|
|
|
|
|
|
|
|
/** Starting position in script where this token came from. */
|
|
|
|
|
int32 StartPos = 0;
|
|
|
|
|
|
|
|
|
|
/** Starting line in script. */
|
|
|
|
|
int32 StartLine = 0;
|
|
|
|
|
|
2021-07-19 14:42:38 -04:00
|
|
|
/** Input line of the token */
|
|
|
|
|
int32 InputLine = 0;
|
|
|
|
|
|
2021-07-19 09:35:19 -04:00
|
|
|
/** The text of the token */
|
|
|
|
|
FStringView Value;
|
|
|
|
|
|
|
|
|
|
// Return true if the token is an identifier
|
|
|
|
|
bool IsIdentifier() const
|
|
|
|
|
{
|
|
|
|
|
return TokenType == ETokenType::Identifier;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test to see if the token value matches the given string
|
|
|
|
|
bool IsValue(const TCHAR* Str, ESearchCase::Type SearchCase) const
|
|
|
|
|
{
|
|
|
|
|
return Value.Equals(Str, SearchCase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test to see if the token value begins with the given string
|
|
|
|
|
bool ValueStartsWith(const TCHAR* Str, ESearchCase::Type SearchCase) const
|
|
|
|
|
{
|
|
|
|
|
return Value.StartsWith(Str, SearchCase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return true if the token is a specific identifier
|
|
|
|
|
bool IsIdentifier(const TCHAR* Str, ESearchCase::Type SearchCase) const
|
|
|
|
|
{
|
|
|
|
|
return IsIdentifier() && IsValue(Str, SearchCase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return true if the token is a symbol
|
|
|
|
|
bool IsSymbol() const
|
|
|
|
|
{
|
|
|
|
|
return TokenType == ETokenType::Symbol;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return true if the token is a specific single character symbol
|
|
|
|
|
bool IsSymbol(const TCHAR Ch) const
|
|
|
|
|
{
|
|
|
|
|
return IsSymbol() && Value.Len() == 1 && Value[0] == Ch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return true if the token is a specific symbol
|
|
|
|
|
bool IsSymbol(const TCHAR* Str, ESearchCase::Type SearchCase) const
|
|
|
|
|
{
|
|
|
|
|
return IsSymbol() && IsValue(Str, SearchCase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return true if the token is a decimal or hexidecimal constant
|
|
|
|
|
bool IsConstInt() const
|
|
|
|
|
{
|
|
|
|
|
return TokenType == ETokenType::DecimalConst || TokenType == ETokenType::HexConst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return true if the token is a specific constant integer
|
|
|
|
|
bool IsConstInt(const TCHAR* Str) const
|
|
|
|
|
{
|
|
|
|
|
return IsConstInt() && IsValue(Str, ESearchCase::CaseSensitive);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return true if the token is a floating point constant
|
|
|
|
|
bool IsConstFloat() const
|
|
|
|
|
{
|
|
|
|
|
return TokenType == ETokenType::FloatConst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return true if the token is a string or character constant
|
|
|
|
|
bool IsConstString() const
|
|
|
|
|
{
|
|
|
|
|
return TokenType == ETokenType::StringConst || TokenType == ETokenType::CharConst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the 32 bit integer value of the token. Only supported for decimal, hexidecimal, and floating point values
|
|
|
|
|
bool GetConstInt(int32& I) const
|
|
|
|
|
{
|
|
|
|
|
switch (TokenType)
|
|
|
|
|
{
|
|
|
|
|
case ETokenType::DecimalConst:
|
|
|
|
|
I = (int32)GetDecimalValue();
|
|
|
|
|
return true;
|
|
|
|
|
case ETokenType::HexConst:
|
|
|
|
|
I = (int32)GetHexValue();
|
|
|
|
|
return true;
|
|
|
|
|
case ETokenType::FloatConst:
|
|
|
|
|
{
|
|
|
|
|
float Float = GetFloatValue();
|
|
|
|
|
if (Float == FMath::TruncToInt(Float))
|
|
|
|
|
{
|
|
|
|
|
I = (int32)Float;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the 64 bit integer value of the token. Only supported for decimal, hexidecimal, and floating point values
|
|
|
|
|
bool GetConstInt64(int64& I) const
|
|
|
|
|
{
|
|
|
|
|
switch (TokenType)
|
|
|
|
|
{
|
|
|
|
|
case ETokenType::DecimalConst:
|
|
|
|
|
I = GetDecimalValue();
|
|
|
|
|
return true;
|
|
|
|
|
case ETokenType::HexConst:
|
|
|
|
|
I = GetHexValue();
|
|
|
|
|
return true;
|
|
|
|
|
case ETokenType::FloatConst:
|
|
|
|
|
{
|
|
|
|
|
float Float = GetFloatValue();
|
|
|
|
|
if (Float == FMath::TruncToInt(Float))
|
|
|
|
|
{
|
|
|
|
|
I = (int32)Float;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return a string representation of a constant value. In the case of strings, the surrounding quotes and \n escapres are removed/converted
|
|
|
|
|
FString GetConstantValue() const
|
|
|
|
|
{
|
|
|
|
|
switch (TokenType)
|
|
|
|
|
{
|
|
|
|
|
case ETokenType::DecimalConst:
|
|
|
|
|
return FString::Printf(TEXT("%" INT64_FMT), GetDecimalValue());
|
|
|
|
|
case ETokenType::HexConst:
|
|
|
|
|
return FString::Printf(TEXT("%" INT64_FMT), GetHexValue());
|
|
|
|
|
case ETokenType::FloatConst:
|
|
|
|
|
return FString::Printf(TEXT("%f"), GetFloatValue());
|
|
|
|
|
case ETokenType::TrueConst:
|
|
|
|
|
return FName::GetEntry(NAME_TRUE)->GetPlainNameString();
|
|
|
|
|
case ETokenType::FalseConst:
|
|
|
|
|
return FName::GetEntry(NAME_FALSE)->GetPlainNameString();
|
|
|
|
|
case ETokenType::CharConst:
|
|
|
|
|
case ETokenType::StringConst:
|
|
|
|
|
return FString(*GetTokenString());
|
|
|
|
|
default:
|
|
|
|
|
return TEXT("NotConstant");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return the token value as a null terminated string.
|
|
|
|
|
void GetTokenValue(FTokenValue& TokenValue) const
|
|
|
|
|
{
|
|
|
|
|
Value.CopyString(TokenValue.Value, Value.Len(), 0);
|
2021-11-07 23:43:01 -05:00
|
|
|
TokenValue.Value[Value.Len()] = TEXT('\0');
|
2021-07-19 09:35:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return the token value as a null terminated string.
|
|
|
|
|
FTokenValue GetTokenValue() const
|
|
|
|
|
{
|
|
|
|
|
FTokenValue TokenValue;
|
|
|
|
|
GetTokenValue(TokenValue);
|
|
|
|
|
return TokenValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return the token value for string contants
|
|
|
|
|
void GetTokenString(FTokenString& TokenString) const
|
|
|
|
|
{
|
|
|
|
|
switch (TokenType)
|
|
|
|
|
{
|
|
|
|
|
case ETokenType::StringConst:
|
|
|
|
|
{
|
|
|
|
|
TCHAR* Out = TokenString.String;;
|
|
|
|
|
const TCHAR* Pos = &Value[1];
|
|
|
|
|
TCHAR c = *Pos++;
|
2021-11-07 23:43:01 -05:00
|
|
|
while (c != TEXT('"'))
|
2021-07-19 09:35:19 -04:00
|
|
|
{
|
2021-11-07 23:43:01 -05:00
|
|
|
if (c == TEXT('\\'))
|
2021-07-19 09:35:19 -04:00
|
|
|
{
|
|
|
|
|
c = *Pos++;
|
2021-11-07 23:43:01 -05:00
|
|
|
if (c == TEXT('n'))
|
2021-07-19 09:35:19 -04:00
|
|
|
{
|
|
|
|
|
// Newline escape sequence.
|
2021-11-07 23:43:01 -05:00
|
|
|
c = TEXT('\n');
|
2021-07-19 09:35:19 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*Out++ = c;
|
|
|
|
|
c = *Pos++;
|
|
|
|
|
}
|
2021-11-07 23:43:01 -05:00
|
|
|
*Out++ = TEXT('\0');
|
2021-07-19 09:35:19 -04:00
|
|
|
// If this fails, GetToken has a bug/mismatch
|
|
|
|
|
check(Out - TokenString.String < MAX_STRING_CONST_SIZE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ETokenType::CharConst:
|
|
|
|
|
{
|
|
|
|
|
TCHAR ActualCharLiteral = Value[1];
|
|
|
|
|
|
2021-11-07 23:43:01 -05:00
|
|
|
if (ActualCharLiteral == TEXT('\\'))
|
2021-07-19 09:35:19 -04:00
|
|
|
{
|
|
|
|
|
ActualCharLiteral = Value[2];
|
|
|
|
|
switch (ActualCharLiteral)
|
|
|
|
|
{
|
|
|
|
|
case TCHAR('t'):
|
2021-11-07 23:43:01 -05:00
|
|
|
ActualCharLiteral = TEXT('\t');
|
2021-07-19 09:35:19 -04:00
|
|
|
break;
|
|
|
|
|
case TCHAR('n'):
|
2021-11-07 23:43:01 -05:00
|
|
|
ActualCharLiteral = TEXT('\n');
|
2021-07-19 09:35:19 -04:00
|
|
|
break;
|
|
|
|
|
case TCHAR('r'):
|
2021-11-07 23:43:01 -05:00
|
|
|
ActualCharLiteral = TEXT('\r');
|
2021-07-19 09:35:19 -04:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TokenString.String[0] = ActualCharLiteral;
|
2021-11-07 23:43:01 -05:00
|
|
|
TokenString.String[1] = TEXT('\0');
|
2021-07-19 09:35:19 -04:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
checkf(false, TEXT("Call to GetTokenString on token that isn't a string or char constant"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return the token value for string contants
|
|
|
|
|
FTokenString GetTokenString() const
|
|
|
|
|
{
|
|
|
|
|
FTokenString TokenString;
|
|
|
|
|
GetTokenString(TokenString);
|
|
|
|
|
return TokenString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
float GetFloatValue() const
|
|
|
|
|
{
|
|
|
|
|
int32 Length = Value.Len();
|
|
|
|
|
TCHAR* Temp = reinterpret_cast<TCHAR*>(alloca((Length + 1) * sizeof(TCHAR)));
|
|
|
|
|
Value.CopyString(Temp, Length, 0);
|
2021-11-07 23:43:01 -05:00
|
|
|
Temp[Length] = TEXT('\0');
|
2021-07-19 09:35:19 -04:00
|
|
|
return FCString::Atof(Temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int64 GetDecimalValue() const
|
|
|
|
|
{
|
|
|
|
|
TCHAR* End = const_cast<TCHAR*>(Value.begin()) + Value.Len();
|
|
|
|
|
return FCString::Strtoi64(Value.begin(), &End, 10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int64 GetHexValue() const
|
|
|
|
|
{
|
|
|
|
|
TCHAR* End = const_cast<TCHAR*>(Value.begin()) + Value.Len();
|
|
|
|
|
return FCString::Strtoi64(Value.begin(), &End, 16);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// FBaseParser
|
|
|
|
|
|
2014-05-22 05:21:52 -04:00
|
|
|
enum class ESymbolParseOption
|
|
|
|
|
{
|
|
|
|
|
Normal,
|
|
|
|
|
CloseTemplateBracket
|
|
|
|
|
};
|
|
|
|
|
|
2015-06-15 13:40:28 -04:00
|
|
|
// A specifier with optional value
|
|
|
|
|
struct FPropertySpecifier
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit FPropertySpecifier(FString&& InKey)
|
|
|
|
|
: Key(MoveTemp(InKey))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
explicit FPropertySpecifier(const FString& InKey)
|
|
|
|
|
: Key(InKey)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FString Key;
|
|
|
|
|
TArray<FString> Values;
|
|
|
|
|
|
|
|
|
|
FString ConvertToString() const;
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
//
|
|
|
|
|
// Base class of header parsers.
|
|
|
|
|
//
|
|
|
|
|
|
2021-05-26 09:54:27 -04:00
|
|
|
class FBaseParser
|
2021-05-27 08:04:11 -04:00
|
|
|
: public FUHTMessageProvider
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
protected:
|
2021-05-26 09:54:27 -04:00
|
|
|
FBaseParser(FUnrealSourceFile& InSourceFile);
|
|
|
|
|
virtual ~FBaseParser() = default;
|
2016-12-09 11:36:14 -05:00
|
|
|
|
2021-04-14 18:40:45 -04:00
|
|
|
// UHTConfig data
|
|
|
|
|
const FUHTConfig& UHTConfig;
|
|
|
|
|
|
2016-12-09 11:36:14 -05:00
|
|
|
public:
|
2021-05-26 09:54:27 -04:00
|
|
|
// Source being parsed
|
|
|
|
|
FUnrealSourceFile& SourceFile;
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
// Input text.
|
|
|
|
|
const TCHAR* Input;
|
|
|
|
|
|
|
|
|
|
// Length of input text.
|
|
|
|
|
int32 InputLen;
|
|
|
|
|
|
|
|
|
|
// Current position in text.
|
|
|
|
|
int32 InputPos;
|
|
|
|
|
|
|
|
|
|
// Current line in text.
|
|
|
|
|
int32 InputLine;
|
|
|
|
|
|
|
|
|
|
// Position previous to last GetChar() call.
|
|
|
|
|
int32 PrevPos;
|
|
|
|
|
|
|
|
|
|
// Line previous to last GetChar() call.
|
|
|
|
|
int32 PrevLine;
|
|
|
|
|
|
|
|
|
|
// Previous comment parsed by GetChar() call.
|
|
|
|
|
FString PrevComment;
|
|
|
|
|
|
|
|
|
|
// Number of statements parsed.
|
|
|
|
|
int32 StatementsParsed;
|
|
|
|
|
|
|
|
|
|
// Total number of lines parsed.
|
|
|
|
|
int32 LinesParsed;
|
2016-12-09 11:36:14 -05:00
|
|
|
|
2021-05-26 09:54:27 -04:00
|
|
|
virtual FString GetFilename() const override;
|
|
|
|
|
|
|
|
|
|
virtual int32 GetLineNumber() const override
|
|
|
|
|
{
|
|
|
|
|
return InputLine;
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
void ResetParser(const TCHAR* SourceBuffer, int32 StartingLineNumber = 1);
|
|
|
|
|
|
|
|
|
|
// Low-level parsing functions.
|
|
|
|
|
TCHAR GetChar( bool Literal = false );
|
|
|
|
|
TCHAR PeekChar();
|
|
|
|
|
TCHAR GetLeadingChar();
|
|
|
|
|
void UngetChar();
|
2021-07-19 09:35:19 -04:00
|
|
|
void SkipWhitespaceAndComments();
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests if a character is an end-of-line character.
|
|
|
|
|
*
|
|
|
|
|
* @param c The character to test.
|
|
|
|
|
*
|
|
|
|
|
* @return true if c is an end-of-line character, false otherwise.
|
|
|
|
|
*/
|
|
|
|
|
static bool IsEOL( TCHAR c );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests if a character is a whitespace character.
|
|
|
|
|
*
|
|
|
|
|
* @param c The character to test.
|
|
|
|
|
*
|
|
|
|
|
* @return true if c is an whitespace character, false otherwise.
|
|
|
|
|
*/
|
|
|
|
|
static bool IsWhitespace( TCHAR c );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the next token from the input stream, advancing the variables which keep track of the current input position and line.
|
|
|
|
|
*
|
2014-05-22 05:21:52 -04:00
|
|
|
* @param Token receives the value of the parsed text; if Token is pre-initialized, special logic is performed
|
|
|
|
|
* to attempt to evaluated Token in the context of that type. Useful for distinguishing between ambigous symbols
|
|
|
|
|
* like enum tags.
|
|
|
|
|
* @param NoConsts specify true to indicate that tokens representing literal const values are not allowed.
|
|
|
|
|
* @param ParseTemplateClosingBracket specify true to treat >> as two template closing brackets instead of shift operator.
|
2014-03-14 14:13:41 -04:00
|
|
|
*
|
|
|
|
|
* @return true if a token was successfully processed, false otherwise.
|
|
|
|
|
*/
|
2021-07-19 09:35:19 -04:00
|
|
|
bool GetToken( FToken& Token, bool bNoConsts = false, ESymbolParseOption ParseTemplateClosingBracket = ESymbolParseOption::Normal );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Put all text from the current position up to either EOL or the StopToken
|
2021-07-19 09:35:19 -04:00
|
|
|
* into string. Advances the compiler's current position.
|
2014-03-14 14:13:41 -04:00
|
|
|
*
|
2021-07-19 09:35:19 -04:00
|
|
|
* @param String [out] will contain the text that was parsed
|
2014-03-14 14:13:41 -04:00
|
|
|
* @param StopChar stop processing when this character is reached
|
|
|
|
|
*
|
|
|
|
|
* @return true if a token was parsed
|
|
|
|
|
*/
|
2021-07-19 09:35:19 -04:00
|
|
|
bool GetRawString( FTokenString& String, TCHAR StopChar = TCHAR('\n') );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// Doesn't quit if StopChar is found inside a double-quoted string, but does not support quote escapes
|
2021-07-19 09:35:19 -04:00
|
|
|
bool GetRawStringRespectingQuotes(FTokenString& String, TCHAR StopChar = TCHAR('\n') );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2016-12-09 11:36:14 -05:00
|
|
|
void UngetToken( const FToken& Token );
|
2021-05-21 07:29:12 -04:00
|
|
|
void UngetToken(int32 StartLine, int32 StartPos);
|
2014-03-14 14:13:41 -04:00
|
|
|
bool GetIdentifier( FToken& Token, bool bNoConsts = false );
|
|
|
|
|
|
2021-04-14 18:40:45 -04:00
|
|
|
// Modify token to fix redirected types if needed
|
|
|
|
|
void RedirectTypeIdentifier(FToken& Token) const;
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/**
|
|
|
|
|
* Get an int constant
|
|
|
|
|
* @return true on success, otherwise false.
|
|
|
|
|
*/
|
|
|
|
|
bool GetConstInt(int32& Result, const TCHAR* Tag = NULL);
|
Copying //UE4/Dev-Core to //UE4/Dev-Main (Source: //UE4/Dev-Core @ 3208226)
#lockdown Nick.Penwarden
#rb None
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3173153 on 2016/10/25 by Graeme.Thornton
Pak signing changes
- Integrated into EDL loader
- Changed to not encrypt each CRC in the sig file, rather just store a single encryped signature of the entire sig file. Removes need to decrypt thousands of signatures at startup.
Change 3173531 on 2016/10/25 by Steven.Hutton
Removing unused j query packages.
Change 3174743 on 2016/10/26 by Gil.Gribb
UE4 - fixed COTF with EDL
Change 3177896 on 2016/10/28 by Steve.Robb
TSharedPtr and TSharedRef aliasing constructors.
Removal of static_asserts for TSharedPtr<UObject>.
Change 3180343 on 2016/10/31 by Steve.Robb
Reimplementation of changes from CL#s 3050329 and 3105715 that were lost in merges 3094597 and 3105741.
Change 3181382 on 2016/11/01 by Steve.Robb
Visual Studio debugger visualizers for delegates.
Change 3182738 on 2016/11/02 by Graeme.Thornton
Re-enable signed archive reader so non-pakpreacher based reads still get signature checked
Change 3183420 on 2016/11/02 by Steve.Robb
Fix to TIsZeroConstructType for TScriptDelegate.
Change 3184872 on 2016/11/03 by Robert.Manuszewski
Fixing memory stomps in SSL certificate initialization (found with mallocstomp)
Change 3184873 on 2016/11/03 by Robert.Manuszewski
Adding thread safety checks to async loading code
Change 3185535 on 2016/11/03 by Ben.Zeigler
Fix it so calling CreateDefaultSubobject with bTransient = true sets the object transient flag. This fixes EDL Crashes involving components.
Change 3186636 on 2016/11/04 by Graeme.Thornton
AES encryption integrated into EDL system
Pak signing and AES encryption now configurable by ini files rather than magical text files
Change 3186637 on 2016/11/04 by Graeme.Thornton
Configured pak signing and encryption in ShooterGame for reference
Change 3186639 on 2016/11/04 by Graeme.Thornton
Encryption changes for Orion
* Move pak signing keys into new INI format
* Add AES key and enable INI file encryption
Change 3186661 on 2016/11/04 by Graeme.Thornton
Change unrealpak command line params to accept AES key as a separete parameter
Change 3186670 on 2016/11/04 by Robert.Manuszewski
Adding a null check before using a package pointer in Linker code
#jira UE-38237
Change 3186775 on 2016/11/04 by Graeme.Thornton
Fix UBT defines that come in as quoted strings, losing the quotes when passed to the compiler
- PS4 and Mac fixes. Other platforms might need fixing too!
Change 3186823 on 2016/11/04 by Graeme.Thornton
Fixed an incorrect size check in the EDL pak signing code
Change 3186925 on 2016/11/04 by Graeme.Thornton
Allow UnrealPak to read encryption settings from project ini files
Change 3189885 on 2016/11/08 by Graeme.Thornton
Static analysis warning fix
Change 3190015 on 2016/11/08 by Robert.Manuszewski
Thread safety fix for UBlueprintGeneratedClass::PostLoadDefaultObject while UBlueprintGeneratedClass::SerializeDefaultObject runs on the async loading thread
Change 3190253 on 2016/11/08 by Chris.Wood
Improved MDD performance for on the CR server.
[UE-37566] - Improve MDD performance on CR server
Blocked MDD init'ing the crash handling code as it isn't desirable on the server.
Removed redundant call to SetSymbolPathsFromModules() from CrashDebugHelper.
Change 3192993 on 2016/11/10 by Robert.Manuszewski
Thread Heartbeat will no longer report the same hang multiple times.
Change 3193111 on 2016/11/10 by Robert.Manuszewski
Minor change in the condition that detects the same hangs - allow the same callstacks from different threads
Change 3193168 on 2016/11/10 by Steve.Robb
TSparseArray now reserves space in reverse so that new elements get added to the front of the allocation rather than the back, which is better for memory traversal and meets expectations more closely.
Change 3193171 on 2016/11/10 by Steve.Robb
Easier debugging of FPendingRegistrantInfo map.
Change 3193188 on 2016/11/10 by Steve.Robb
TAutoPointer deprecated.
Change 3193796 on 2016/11/10 by Graeme.Thornton
Fix pak creation failure when no pak signing keys are supplied
Change 3194524 on 2016/11/11 by Graeme.Thornton
Another static analysis warning fix
Change 3195119 on 2016/11/11 by Steve.Robb
TAutoPtr deprecated.
Fixes to use of TAutoPtr with incompatible memory deallocations (TAutoPtr with FMemory::Malloc and new[]).
Some large headers moved into .cpp files.
Change 3196582 on 2016/11/14 by Gil.Gribb
UE4 - Changed a check to a warning related to detaching linekrs twice. Seen in nativized BP version of platformer game.
Change 3196878 on 2016/11/14 by Steve.Robb
TScopedPointer deprecated.
Change 3198061 on 2016/11/15 by Steve.Robb
Class array is no longer regenerated when saving UClasses.
Change 3198065 on 2016/11/15 by Robert.Manuszewski
Making AssembleReferenceTokenStream thread safe for blueprints loaded on the async loading thread.
Change 3198199 on 2016/11/15 by Robert.Manuszewski
Pak platform file will now only be used if pak files exist regardless of command line paraks like -pak, -singedpak and -signed.
Change 3199954 on 2016/11/16 by Graeme.Thornton
Removing USING_SIGNED_CONTENT
Change 3200221 on 2016/11/16 by Chris.Wood
CrashReportProcess code cleanup - removing unused using directives
Change 3200232 on 2016/11/16 by Chris.Wood
Multiple CrashReportProcess updates and improvements (CRP v1.2.6)
UE-36248 - CRP scalability: All bulk storage or shared data to S3 or suitable network drives
InvalidCrashReports now saved to S3 instead of local folder
Removed option tosync MinidumpDiagnostics from Perforce
Moved MinidumpDiagnostics from old Perforce synched location to its own folder in E:\Services (makes more sense with manual publishing)
Added improved logging to Slack with option to monitor MDD performance
Added hourly log folders to MDD logs
Added support for types of crashes we don't want to symbolicate (using it to skip callstack gen for hang detected ensures)
Change 3200382 on 2016/11/16 by Robert.Manuszewski
Async Loading code will now detach the linker when resetting async package loader to avoid situations when loading the same asset multiple times results in the following load request finding the old linker after the package has been loading but the async package hasn't been deleted yet (async package for the old request in limbo state but linker exists).
Change 3200562 on 2016/11/16 by Gil.Gribb
UE4 - Fixed rare issue with reloading nativized blueprints with the EDL and a minor simplication.
Change 3201093 on 2016/11/16 by Ben.Zeigler
#UE 38654 Fix EDL cooking to correctly search components created directly by UBlueprints, as well as the CDO components it already covered. Also explicitly mark subobject templates as editor only.
Fix issue where the AssetImportData associated with Blueprint-owned Curves was ending up in the cooked subobject template list. Stopped it from creating those objects, and mark the class editor only.
Change 3201736 on 2016/11/17 by Steve.Robb
Strtoi64 platform and TCString functions.
#fyi robert.manuszewski
Change 3201938 on 2016/11/17 by Ben.Woodhouse
Dummy integrate of the Square render version workaround (CL 3201913) with _accept target_ to prevent it being integrated to dev-core in future.
Commandline:
p4 integrate //Tasks/UE4/Dev-LoadTimes/Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp@3201913,3201913 //UE4/Dev-Core/Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp
#fyi robert.manuszewski
Change 3203757 on 2016/11/18 by Robert.Manuszewski
Removing debug code from async loading code.
Change 3203927 on 2016/11/18 by Robert.Manuszewski
Fixing comments in the async loading code.
Change 3204851 on 2016/11/18 by Steve.Robb
Metafunction for testing if a particular operator<< overload exists, e.g. THasInserterOperator<FArchive&, FMyType&>::Value.
Change 3204854 on 2016/11/18 by Steve.Robb
UEnumProperty.
Change 3205027 on 2016/11/18 by Ben.Zeigler
Add useful functions to FAssetPtr and TAssetSubclassOf that already existed on TAssetPtr
Add Get() to TSubclassOf so it matches our other wrappers
Fix TSubclassOf and TAssetSubclassOf to use the more efficient template method of checking class compatibility
Comment and template cleanups for AssetPtr, StringAssetReference, LazyPtr, and SubclassOf
Change 3206334 on 2016/11/21 by Ben.Zeigler
#UE-38773: Fix it so non-component template subobjects of CDOs are not included as creation dependencies for BP classes, also clean up GetPreloadDependencies as it was adding redundant and null entries
#UE-38799: Fix it so WidgetTrees don't get picked up as subobjects, and add ensure at cook time to find null outers that would crash at runtime. Make sure the instanced widget trees are transient.
Cook finishes but game is still crashing in some cases, so I might adjust this after other testing
Change 3206353 on 2016/11/21 by Ben.Zeigler
Fix EnumProperty to handle EDL preload dependencies properly
Change 3206625 on 2016/11/21 by Ben.Zeigler
Fix enum property crash at runtime by copying what array property does and making sure inner property is not transient
Change 3206937 on 2016/11/21 by Ben.Zeigler
#jira UE-38905 Fix it so enums inside arrays are migrated properly, the enum tag is lost so use the current one
Disable other nested enum migrations as they are unlikely to work. Array property tags need to be refactored to be safer
Correctly save enum tag for enum properties, it was being set but not serialized
Change 3207002 on 2016/11/21 by Ben.Zeigler
#jira UE-38799
Fix it so per-widget copy of widget tree and all widgets inside are properly transient, they were being cooked before but never accessed.
Fix case where non ClientOnly public objects nested instead ClientOnly objects would cook but fail to load, and add ensure to catch these cases in the future.
If the full outer chain isn't available, it can't be loaded anyway, and this finds issues at cook time instead of load time.
We should generally outlaw non-transient objects with transient outers, it does not do what people expect.
Change 3207032 on 2016/11/21 by Ben.Zeigler
#jira UE-38654 Re-Fix EDL cooking with SCS-added components. They used to have the DefaultSubObject flag but no longer do
[CL 3208270 by Ben Zeigler in Main branch]
2016-11-22 18:45:44 -05:00
|
|
|
bool GetConstInt64(int64& Result, const TCHAR* Tag = NULL);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// Matching predefined text.
|
2019-12-31 16:09:30 -05:00
|
|
|
bool MatchIdentifier( const TCHAR* Match, ESearchCase::Type SearchCase);
|
Copying //UE4/Dev-Core to //UE4/Dev-Main (Source: //UE4/Dev-Core @ 3049602)
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2946506 on 2016/04/18 by Steven.Hutton
Update to Crash Reporter buggs table to add new search fields and inclusion of packages needed for e-mail reports.
Change 3017807 on 2016/06/17 by Chris.Wood
Improved Crash Report Process folder delete code as it could sometimes fail.
[UE-30349] - Crash Report Process is leaving crashes in the landing zone that build up and block the queue
Also added logging to Slack when stop request received instead of just when stop is complete.
Change 3019367 on 2016/06/20 by Chris.Wood
Improve Crash Report Process logging to track bad reads from S3.
Also, better logging when CleanReport fails to delete folders.
Change 3019376 on 2016/06/20 by Steve.Robb
Clarification of assert message and comments which talk about 'null' TFunctions.
Tidy-up of dead code.
Change 3019409 on 2016/06/20 by Steve.Robb
New Find and FindByPredicate algorithms for finding stuff in arbitrary containers.
Change 3022658 on 2016/06/22 by Chris.Wood
Discarding duplicated crash reports earlier in read from Data Router process to avoid clashes in the landing zone (CRP v1.1.11)
[UE-30349] - Crash Report Process is leaving crashes in the landing zone that build up and block the queue
Also improved logging to Slack with better layout, fixed event ordering and counting duplicates.
Change 3022840 on 2016/06/22 by Steve.Robb
Skipped UHT attributes removed.
Change 3022907 on 2016/06/22 by Robert.Manuszewski
Fixing crash when adding a new C++ class to project
#jira UE-32333
Change 3023169 on 2016/06/22 by Steve.Robb
Checks for UTHINGs in skipped preprocessor blocks.
Fixes for skipped UTHINGs and some other parsing accidents.
#jira UE-31627
Change 3023239 on 2016/06/22 by Steve.Robb
Fix for JSON date parsing reported here: https://udn.unrealengine.com/questions/299342/fdatetime-json-serialization-bug.html
Change 3026812 on 2016/06/24 by Mieszko.Zielinski
Marked FEnvQueryInstance::AddItemData UEnvQueryItemType_Point specialization as AIMODULE_API #UE4
Change 3028235 on 2016/06/27 by Robert.Manuszewski
PR #2535: BUGFIX: FPS pop-up updates when loading new stat file (Contributed by projectgheist)
Change 3028282 on 2016/06/27 by Steve.Robb
Fix for missing UFUNCTION check in skipped preprocessor blocks.
#jira UE-31627
Change 3028284 on 2016/06/27 by Steve.Robb
Debuggability improvements and coding standards changes.
Change 3028343 on 2016/06/27 by Steve.Robb
Fix for UHT error in WEX.
#jira UE-32464
Change 3028393 on 2016/06/27 by Steve.Robb
Fix for hot reload of enums finding the old enum.
Fix to stop SPropertyEditorNumeric caching the enum flags.
#jira UE-31658
Change 3030362 on 2016/06/28 by Robert.Manuszewski
Fixing hang when cooking.
Change 3030462 on 2016/06/28 by Steve.Robb
Assert added to PackageTools::GetFilteredPackageList() to help with catching a bug reported in the wild.
#jira UE-32001
Change 3034341 on 2016/06/30 by Robert.Manuszewski
Modified crash handling code (on Windows) to handle two threads crashing at the same time properly. Previously the second crash would force the process to exit before generating the crash report.
Added 'debug twothreadsgpf' command to test the functionality.
Change 3034342 on 2016/06/30 by John.Mahoney
Fix for crash when loading an empty cached asset registry.
#jira UE-32232
Change 3035599 on 2016/07/01 by Chris.Wood
Added support for CrashType string to Crash Report Process. CRP v1.1.12
[UE-30592] - Crash Reporter should determine crash type on client and pass string to server
Also fixes problem with reports falling back on the legacy WER metadata when a crash context exists. They now only read the error message from metadata if available and keep crash context data when possible.
Added in missing crash context parameters that have been added to clients but not known by the server.
Change 3035787 on 2016/07/01 by John.Mahoney
Fix for crash when DuplicateRedirects does not contain the DependentObject when saving dependencies. It will still fall through to the assertion below, but it will now fail with a useful error message instead of a generic 'Pair != nullptr' from Map.h.
#jira UE-30189
Change 3036933 on 2016/07/04 by Steve.Robb
Proper forwarding constructor for FAsyncTask.
Change 3036938 on 2016/07/04 by Steve.Robb
Fix for CDO hot reload corrupting memory when replacing references inside structs.
#jira UE-29335
Change 3036960 on 2016/07/04 by Steve.Robb
Fix for FAnsiAllocator::ResizeAllocation when resizing to zero.
Change 3037423 on 2016/07/05 by Steve.Robb
FModuleManager::UnloadOrAbandonModuleWithCallback split into two instead of switching behavior with a bool.
Change 3037464 on 2016/07/05 by Steve.Robb
HotReload.cpp cleanup:
Deep nesting flattened.
Linear array searches replaced with maps.
FHotReloadModule::GetGameModules made into a non-member function and split into two.
Comment and coding standard fixes.
Change 3037741 on 2016/07/05 by John.Mahoney
Fix for COTF not checking the correct timestamps on startup.
#jira UE-31023
Change 3037846 on 2016/07/05 by Steve.Robb
Fix for compile button disappearing on a bad compile.
#jira UE-31575
Change 3037994 on 2016/07/05 by Steve.Robb
Static analysis fixes:
warning C6308: 'realloc' might return null pointer: assigning null pointer to 'Data', which is passed as an argument to 'realloc', will cause the original memory block to be leaked.
Change 3039186 on 2016/07/06 by Robert.Manuszewski
Enabling crash callstack logging by default.
Change 3039220 on 2016/07/06 by Steve.Robb
Static analysis fixes:
warning C28159: Consider using 'InitiateSystemShutdownEx' instead of 'ExitWindowsEx'. Reason: Legacy API. Rearchitect to avoid Reboot
warning C6001: Using uninitialized memory 'UserNameLength'
warning C6001: Using uninitialized memory 'DomainNameLength'
Change 3039230 on 2016/07/06 by Steve.Robb
Fix for VC internal compiler errors.
Change 3039237 on 2016/07/06 by Steve.Robb
Static analysis fix: warning C6385: Reading invalid data from 'Path': the readable size is '400' bytes, but 'PathCurrentDepth' bytes may be read.
Change 3039287 on 2016/07/06 by Steve.Robb
Static analysis fixes:
warning C6509: Invalid annotation: 'return' cannot be referenced in some contexts
warning C6101: Returning uninitialized memory '*lpdwExitCode'. A successful path through the function does not set the named _Out_ parameter.
warning C6387: '_Param_(1)' could be '0': this does not adhere to the specification for the function 'IMoniker::BindToStorage'.
warning C6387: '_Param_(1)' could be '0': this does not adhere to the specification for the function 'IMoniker::BindToObject'.
warning C6031: Return value ignored: 'CoCreateInstance'.
Change 3039359 on 2016/07/06 by Graeme.Thornton
Compile error fix for FAsyncTask, courtesy of SteveR
Change 3039534 on 2016/07/06 by Steve.Robb
Static analysis fix: warning C6319: Use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects.
Change 3039545 on 2016/07/06 by Steve.Robb
Static analysis fix: warning C6297: Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value. Results might not be an expected value.
Change 3039578 on 2016/07/06 by Steve.Robb
Static analysis fix: warning C6263: Using _alloca in a loop: this can quickly overflow stack.
Change 3039623 on 2016/07/06 by Steve.Robb
Static analysis fixes:
warning C6011: Dereferencing NULL pointer 'X'
warning C6308:'realloc' might return null pointer: assigning null pointer to 'X', which is passed as an argument to 'realloc', will cause the original memory block to be leaked.
warning C6385: Reading invalid data from 'X': the readable size is 'Y' bytes, but 'Z' bytes may be read.
warning C6386: Buffer overrun while writing to 'X': the writable size is 'Y' bytes, but 'Z' bytes might be written.
warning C28182: Dereferencing NULL pointer. 'X' contains the same NULL value as 'Y' did.
Change 3039630 on 2016/07/06 by John.Mahoney
Fix for crash when spawning an actor using a template object that has instance components. UActorComponent::PostInitProperties was adding itself to the owner's InstanceComponents array, resulting in a realloc of that array and invalidating the reference that the owner's ObjectInitializer was trying to replace while instantiating that property. The new instance component will be added to the array as part of the owner's initialization anyway, so it is not necessary to do it here.
#jira UE-29123
Change 3039664 on 2016/07/06 by Steve.Robb
Static analysis fixes:
warning C6386: Buffer overrun while writing to 'NewKeys': the writable size is 'NewIndexSize*4' bytes, but '8' bytes might be written.
warning C6386: Buffer overrun while writing to 'NewHeapIndexes': the writable size is 'NewIndexSize*4' bytes, but '8' bytes might be written.
Change 3039673 on 2016/07/06 by Steve.Robb
Static analysis fix: warning C6011: Dereferencing NULL pointer 'v'.
Change 3039690 on 2016/07/06 by Steve.Robb
Static analysis fixes:
warning C6011: Dereferencing NULL pointer 'X'.
warning C6246: Local declaration of 'X' hides declaration of the same name in outer scope.
warning C6262: Function uses '121180' bytes of stack: exceeds /analyze:stacksize '81940'. Consider moving some data to heap.
warning C6263: Using _alloca in a loop: this can quickly overflow stack.
Change 3040868 on 2016/07/07 by Graeme.Thornton
Config based class stripping for server builds
Change 3040872 on 2016/07/07 by Graeme.Thornton
Remove "return false" NeedsLoadForServer functions from engine code
Change 3040997 on 2016/07/07 by Steve.Robb
Static analysis fixes:
warning C6011: Dereferencing NULL pointer 'Landscape'.
warning C6011: Dereferencing NULL pointer 'rhs.Allocation.LayerInfo'.
warning C6011: Dereferencing NULL pointer 'lhs.Allocation.LayerInfo'.
Change 3041004 on 2016/07/07 by Steve.Robb
Static analysis fix: warning C6336: Arithmetic operator has precedence over question operator, use parentheses to clarify intent.
Change 3041014 on 2016/07/07 by Steve.Robb
Static analysis fix: warning C6287: Redundant code: the left and right sub-expressions are identical.
Change 3041111 on 2016/07/07 by Steve.Robb
Removal of an obsolete error message about INI file case sensitivity.
Change 3041150 on 2016/07/07 by Steve.Robb
Static analysis fix: warning C6289: Incorrect operator: mutual exclusion over || is always a non-zero constant. Did you intend to use && instead?
Change 3041274 on 2016/07/07 by Steve.Robb
Static analysis fixes: warning C6001: Using uninitialized memory 'X'.
Change 3041294 on 2016/07/07 by Chris.Wood
Fixed protocol buffer and decompression errors in Crash Report Process (v.1.1.14)
[UE-32151] - High number of crashes read from S3 by Crash Report Process are failing to unpack
Size of buffer received from S3 is incorrect for some records. Fixed read problems by using size header value instead of stream length.
Increased buffer size for decompression as this was sometimes too small.
Modified S3 reading code to look for multiple records in each downloaded file.
Change 3041472 on 2016/07/07 by Steve.Robb
Static analysis fixes:
warning C6294: Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed.
warning C6201: Index '1' is out of valid index range '0' to '0' for possibly stack allocated buffer 'NewHistory.Nodes'.
Change 3043074 on 2016/07/08 by John.Mahoney
Fix for COTF incorrectly reconstructing the original asset path based on the sandbox path when the game name differs from the game folder name.
Fix for COTF GetFiles not handling absolute GameDir paths properly.
#jira UE-31023
Change 3044461 on 2016/07/11 by Steve.Robb
Static analysis fix: warning C6386: Buffer overrun while writing to 'Attributes': the writable size is '16384' bytes, but '-8' bytes might be written.
Change 3044470 on 2016/07/11 by Steve.Robb
Static analysis fix: warning C6011: Dereferencing NULL pointer 'Node.Sequence'.
Change 3044476 on 2016/07/11 by Steve.Robb
Static analysis fix: warning C6011: Dereferencing NULL pointer 'Property'.
Change 3044551 on 2016/07/11 by Steve.Robb
Static analysis fix: warning C28182: Dereferencing NULL pointer. 'Node' contains the same NULL value as 'KeyAreaNode' did.
Change 3044664 on 2016/07/11 by Steve.Robb
Static analysis fixes:
warning C6011: Dereferencing NULL pointer 'ToLandscape->SplineComponent'.
warning C28182: Dereferencing NULL pointer. 'SplinesComponent' contains the same NULL value as 'Landscape->SplineComponent' did.
warning C6011: Dereferencing NULL pointer 'Landscape->SplineComponent'.
warning C6385: Reading invalid data from 'out': the readable size is 'sizeof(kiss_fft_cpx)*Dims[0]*Dims[1]' bytes, but '16' bytes may be read.
Change 3044716 on 2016/07/11 by Steve.Robb
Static analysis fix: warning C6385: Reading invalid data from 'this->ScreenSize': the readable size is '32' bytes, but '-4' bytes may be read.
Change 3044717 on 2016/07/11 by Steve.Robb
Static analysis fix: warning C28182: Dereferencing NULL pointer. 'Window' contains the same NULL value as 'ElementType * Window=AllWindows.FindByPredicate((*FStaticMeshEditorTest::RunTest::<lambda_46fd0093f3912289e870263afe1fcb2e>(ExpectedTitle)))' did.
This appears to be a false positive.
Change 3044787 on 2016/07/11 by Steve.Robb
Static analysis fixes:
warning C6011: Dereferencing NULL pointer 'FbxObject'.
warning C28182: Dereferencing NULL pointer. 'Node' contains the same NULL value as 'RigidMeshNode' did.
warning C28182: Dereferencing NULL pointer. 'Node' contains the same NULL value as 'Result' did.
Change 3045933 on 2016/07/12 by Steve.Robb
Overloading support for TSharedPtr, TSharedRef and TWeakPtr.
Change 3045960 on 2016/07/12 by Robert.Manuszewski
Fixing a crash in Portal (and any other program that uses UObjects and GCs, with the exception of UHT) caused by classes not having their token stream assembled.
Change 3045963 on 2016/07/12 by Steve.Robb
PLATFORM_COMPILER_HAS_EXPLICIT_OPERATORS, FORCEINLINE_EXPLICIT_OPERATOR_BOOL and SAFE_BOOL_OPERATORS macros removed.
THasOperatorEquals and THasOperatorNotEquals traits moved to their own header.
Change 3045967 on 2016/07/12 by Steve.Robb
Initializer list support for TArray and TSet.
Change 3045968 on 2016/07/12 by Robert.Manuszewski
Fixing an ensure after typing 'stat dumphitches' in console.
Change 3045992 on 2016/07/12 by Robert.Manuszewski
Making sure CoreUObject headers are included for programs that don't include the engine (fixing MinidumpDiagnostics CIS failure)
Change 3047870 on 2016/07/13 by Steven.Hutton
Updated CRW to entity framework with repository models. #rb none
Change 3047871 on 2016/07/13 by Steven.Hutton
Add repository models #rb none
Change 3049468 on 2016/07/14 by Steven.Hutton
Fix broken project files. #rb none
#lockdown Nick.Penwarden
[CL 3050320 by Robert Manuszewski in Main branch]
2016-07-14 14:54:00 -04:00
|
|
|
bool MatchConstInt( const TCHAR* Match );
|
2018-10-29 07:04:20 -04:00
|
|
|
bool MatchAnyConstInt();
|
2019-12-31 16:09:30 -05:00
|
|
|
bool PeekIdentifier( const TCHAR* Match, ESearchCase::Type SearchCase);
|
|
|
|
|
bool MatchSymbol( const TCHAR Match, ESymbolParseOption bParseTemplateClosingBracket = ESymbolParseOption::Normal );
|
|
|
|
|
bool MatchSymbol(const TCHAR* Match, ESymbolParseOption bParseTemplateClosingBracket = ESymbolParseOption::Normal);
|
2014-03-14 14:13:41 -04:00
|
|
|
void MatchSemi();
|
2019-12-31 16:09:30 -05:00
|
|
|
bool PeekSymbol( const TCHAR Match );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// Requiring predefined text.
|
2019-12-31 16:09:30 -05:00
|
|
|
void RequireIdentifier( const TCHAR* Match, ESearchCase::Type SearchCase, const TCHAR* Tag );
|
2021-07-19 09:35:19 -04:00
|
|
|
void RequireSymbol(const TCHAR Match, const TCHAR* Tag, ESymbolParseOption bParseTemplateClosingBracket = ESymbolParseOption::Normal);
|
|
|
|
|
void RequireSymbol(const TCHAR Match, const FStringView& Tag, ESymbolParseOption bParseTemplateClosingBracket = ESymbolParseOption::Normal);
|
2019-12-31 16:09:30 -05:00
|
|
|
void RequireSymbol(const TCHAR Match, TFunctionRef<FString()> TagGetter, ESymbolParseOption bParseTemplateClosingBracket = ESymbolParseOption::Normal);
|
2018-10-29 07:04:20 -04:00
|
|
|
void RequireConstInt( const TCHAR* Match, const TCHAR* Tag );
|
|
|
|
|
void RequireAnyConstInt( const TCHAR* Tag );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/** Clears out the stored comment. */
|
|
|
|
|
void ClearComment();
|
|
|
|
|
|
|
|
|
|
// Reads a new-style value
|
|
|
|
|
//@TODO: UCREMOVAL: Needs a better name
|
2019-12-31 16:09:30 -05:00
|
|
|
FString ReadNewStyleValue(const TCHAR* TypeOfSpecifier);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// Reads ['(' Value [',' Value]* ')'] and places each value into the Items array
|
2019-12-31 16:09:30 -05:00
|
|
|
bool ReadOptionalCommaSeparatedListInParens(TArray<FString>& Items, const TCHAR* TypeOfSpecifier);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
//////////////
|
|
|
|
|
// Complicated* parsing code that needs to be shared between the preparser and the parser
|
|
|
|
|
// (* i.e., doesn't really belong in the base parser)
|
|
|
|
|
|
|
|
|
|
// Expecting Name | (MODULE_API Name)
|
|
|
|
|
// Places Name into DeclaredName
|
|
|
|
|
// Places MODULE_API (where MODULE varies) into RequiredAPIMacroIfPresent
|
|
|
|
|
// FailureMessage is printed out if the expectation is broken.
|
|
|
|
|
void ParseNameWithPotentialAPIMacroPrefix(FString& DeclaredName, FString& RequiredAPIMacroIfPresent, const TCHAR* FailureMessage);
|
|
|
|
|
|
|
|
|
|
// Reads a set of specifiers (with optional values) inside the () of a new-style metadata macro like UPROPERTY or UFUNCTION
|
2019-12-31 16:09:30 -05:00
|
|
|
void ReadSpecifierSetInsideMacro(TArray<FPropertySpecifier>& SpecifiersFound, const TCHAR* TypeOfSpecifier, TMap<FName, FString>& MetaData);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// Validates and inserts one key-value pair into the meta data map
|
2021-05-26 09:54:27 -04:00
|
|
|
void InsertMetaDataPair(TMap<FName, FString>& MetaData, FString InKey, FString InValue);
|
2019-12-31 16:09:30 -05:00
|
|
|
|
|
|
|
|
// Validates and inserts one key-value pair into the meta data map
|
2021-05-26 09:54:27 -04:00
|
|
|
void InsertMetaDataPair(TMap<FName, FString>& MetaData, FName InKey, FString InValue);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-05-19 07:42:12 -04:00
|
|
|
/**
|
|
|
|
|
* Parse class/struct inheritance.
|
|
|
|
|
*
|
|
|
|
|
* @param What The name of the statement we are parsing. (i.e. 'class')
|
|
|
|
|
* @param InLambda Function to call for every parent. Must be in the form of
|
|
|
|
|
* Lambda(const TCHAR* Identifier, bool bSuperClass)
|
|
|
|
|
*/
|
|
|
|
|
template <typename Lambda>
|
|
|
|
|
void ParseInheritance(const TCHAR* What, Lambda&& InLambda);
|
|
|
|
|
|
2021-05-27 10:12:41 -04:00
|
|
|
/**
|
|
|
|
|
* Parse the underlying enum type
|
|
|
|
|
*/
|
|
|
|
|
EUnderlyingEnumType ParseUnderlyingEnumType();
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
//////////////
|
2021-03-18 11:03:01 -04:00
|
|
|
|
|
|
|
|
// Initialize the metadata keywords prior to parsing
|
|
|
|
|
static void InitMetadataKeywords();
|
2021-07-19 14:42:38 -04:00
|
|
|
|
|
|
|
|
TArray<FToken> RecordedTokens;
|
|
|
|
|
bool bRecordTokens = false;
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|
2021-05-19 07:42:12 -04:00
|
|
|
|
|
|
|
|
template <typename Lambda>
|
|
|
|
|
void FBaseParser::ParseInheritance(const TCHAR* What, Lambda&& InLambda)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!MatchSymbol(TEXT(':')))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Process the super class
|
|
|
|
|
{
|
|
|
|
|
FToken Token;
|
|
|
|
|
RequireIdentifier(TEXT("public"), ESearchCase::CaseSensitive, TEXT("inheritance"));
|
|
|
|
|
if (!GetIdentifier(Token))
|
|
|
|
|
{
|
2021-05-27 08:04:11 -04:00
|
|
|
Throwf(TEXT("Missing %s name"), What);
|
2021-05-19 07:42:12 -04:00
|
|
|
}
|
|
|
|
|
RedirectTypeIdentifier(Token);
|
2021-07-19 09:35:19 -04:00
|
|
|
InLambda(*FString(Token.Value), true);
|
2021-05-19 07:42:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle additional inherited interface classes
|
|
|
|
|
while (MatchSymbol(TEXT(',')))
|
|
|
|
|
{
|
|
|
|
|
RequireIdentifier(TEXT("public"), ESearchCase::CaseSensitive, TEXT("Interface inheritance must be public"));
|
|
|
|
|
|
|
|
|
|
FString InterfaceName;
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
FToken Token;
|
|
|
|
|
if (!GetIdentifier(Token, true))
|
|
|
|
|
{
|
2021-05-27 08:04:11 -04:00
|
|
|
Throwf(TEXT("Failed to get interface class identifier"));
|
2021-05-19 07:42:12 -04:00
|
|
|
}
|
|
|
|
|
|
2021-07-19 09:35:19 -04:00
|
|
|
InterfaceName += Token.Value;
|
2021-05-19 07:42:12 -04:00
|
|
|
|
|
|
|
|
// Handle templated native classes
|
|
|
|
|
if (MatchSymbol(TEXT('<')))
|
|
|
|
|
{
|
|
|
|
|
InterfaceName += TEXT('<');
|
|
|
|
|
|
|
|
|
|
int32 NestedScopes = 1;
|
|
|
|
|
while (NestedScopes)
|
|
|
|
|
{
|
|
|
|
|
if (!GetToken(Token))
|
|
|
|
|
{
|
2021-05-27 08:04:11 -04:00
|
|
|
Throwf(TEXT("Unexpected end of file"));
|
2021-05-19 07:42:12 -04:00
|
|
|
}
|
|
|
|
|
|
2021-07-19 09:35:19 -04:00
|
|
|
if (Token.IsSymbol(TEXT('<')))
|
2021-05-19 07:42:12 -04:00
|
|
|
{
|
2021-07-19 09:35:19 -04:00
|
|
|
++NestedScopes;
|
|
|
|
|
}
|
|
|
|
|
else if (Token.IsSymbol(TEXT('>')))
|
|
|
|
|
{
|
|
|
|
|
--NestedScopes;
|
2021-05-19 07:42:12 -04:00
|
|
|
}
|
|
|
|
|
|
2021-07-19 09:35:19 -04:00
|
|
|
InterfaceName += Token.Value;
|
2021-05-19 07:42:12 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle scoped native classes
|
|
|
|
|
if (MatchSymbol(TEXT("::")))
|
|
|
|
|
{
|
|
|
|
|
InterfaceName += TEXT("::");
|
|
|
|
|
|
|
|
|
|
// Keep reading nested identifiers
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
InLambda(*InterfaceName, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-19 14:42:38 -04:00
|
|
|
|
|
|
|
|
class FTokenReplay
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit FTokenReplay(const TArray<FToken>& InTokens)
|
|
|
|
|
: Tokens(InTokens)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GetToken(FToken& Token)
|
|
|
|
|
{
|
|
|
|
|
if (CurrentIndex < Tokens.Num())
|
|
|
|
|
{
|
|
|
|
|
Token = Tokens[CurrentIndex++];
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Token = FToken();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UngetToken(const FToken& Token)
|
|
|
|
|
{
|
|
|
|
|
while (CurrentIndex > 0)
|
|
|
|
|
{
|
|
|
|
|
--CurrentIndex;
|
|
|
|
|
if (Tokens[CurrentIndex].StartPos == Token.StartPos)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MatchIdentifier(const TCHAR* Match, ESearchCase::Type SearchCase)
|
|
|
|
|
{
|
|
|
|
|
if (CurrentIndex < Tokens.Num() && Tokens[CurrentIndex].IsIdentifier(Match, SearchCase))
|
|
|
|
|
{
|
|
|
|
|
++CurrentIndex;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MatchSymbol(const TCHAR Match)
|
|
|
|
|
{
|
|
|
|
|
if (CurrentIndex < Tokens.Num() && Tokens[CurrentIndex].IsSymbol(Match))
|
|
|
|
|
{
|
|
|
|
|
++CurrentIndex;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MatchSymbol(const TCHAR* Match)
|
|
|
|
|
{
|
|
|
|
|
if (CurrentIndex < Tokens.Num() && Tokens[CurrentIndex].IsSymbol(Match, ESearchCase::CaseSensitive))
|
|
|
|
|
{
|
|
|
|
|
++CurrentIndex;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const TArray<FToken>& Tokens;
|
|
|
|
|
int CurrentIndex = 0;
|
|
|
|
|
};
|