Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
AssertionMacros.h File Reference
+ Include dependency graph for AssertionMacros.h:

Go to the source code of this file.

Classes

struct  FEnsureHandlerArgs
 
struct  FDebug
 

Namespaces

namespace  ELogVerbosity
 
namespace  UEAsserts_Private
 

Macros

#define UE_DEBUG_SECTION
 
#define UE_DEBUG_BREAK_AND_PROMPT_FOR_REMOTE()    if (!FPlatformMisc::IsDebuggerPresent()) { FPlatformMisc::PromptForRemoteDebugging(false); } UE_DEBUG_BREAK();
 
#define _DebugBreakAndPromptForRemote()    UE_DEPRECATED_MACRO(5.1, "Use UE_DEBUG_BREAK_AND_PROMPT_FOR_REMOTE.")
 
#define PLATFORM_BREAK_IF_DESIRED()   if (LIKELY(!GIgnoreDebugger)) { PLATFORM_BREAK(); }
 
#define checkCode(...)
 
#define check(expr)   { CA_ASSUME(expr); }
 
#define checkf(expr, format, ...)   { CA_ASSUME(expr); }
 
#define checkNoEntry()
 
#define checkNoReentry()
 
#define checkNoRecursion()
 
#define verifyf(expr, format, ...)   { if(UNLIKELY(!(expr))){ CA_ASSUME(false); } }
 
#define unimplemented()   { CA_ASSUME(false); }
 
#define checkSlow(expr)   { CA_ASSUME(expr); }
 
#define checkfSlow(expr, format, ...)   { CA_ASSUME(expr); }
 
#define verifySlow(expr)   { if(UNLIKELY(!(expr))) { CA_ASSUME(false); } }
 
#define ensure( InExpression)   (!!(InExpression))
 
#define ensureMsgf( InExpression, InFormat, ...)   (!!(InExpression))
 
#define ensureAlways( InExpression)   (!!(InExpression))
 
#define ensureAlwaysMsgf(InExpression, InFormat, ...)   (!!(InExpression))
 
#define GET_ENUMERATOR_NAME_CHECKED(EnumName, EnumeratorName)    ((void)sizeof(UEAsserts_Private::GetMemberNameCheckedJunk(EnumName::EnumeratorName)), FName(TEXT(#EnumeratorName)))
 
#define GET_MEMBER_NAME_CHECKED(ClassName, MemberName)    ((void)sizeof(UEAsserts_Private::GetMemberNameCheckedJunk(((ClassName*)0)->MemberName)), FName(TEXT(#MemberName)))
 
#define GET_MEMBER_NAME_STRING_CHECKED(ClassName, MemberName)    ((void)sizeof(UEAsserts_Private::GetMemberNameCheckedJunk(((ClassName*)0)->MemberName)), TEXT(#MemberName))
 
#define GET_FUNCTION_NAME_CHECKED(ClassName, FunctionName)    ((void)sizeof(&ClassName::FunctionName), FName(TEXT(#FunctionName)))
 
#define GET_FUNCTION_NAME_STRING_CHECKED(ClassName, FunctionName)    ((void)sizeof(&ClassName::FunctionName), TEXT(#FunctionName))
 
#define GET_FUNCTION_NAME_CHECKED_OneParam(ClassName, FunctionName, ArgType)    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType)>()), (int)0)), FName(TEXT(#FunctionName)))
 
#define GET_FUNCTION_NAME_CHECKED_TwoParams(ClassName, FunctionName, ArgType1, ArgType2)    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>()), (int)0)), FName(TEXT(#FunctionName)))
 
#define GET_FUNCTION_NAME_CHECKED_ThreeParams(ClassName, FunctionName, ArgType1, ArgType2, ArgType3)    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType3)>()), (int)0)), FName(TEXT(#FunctionName)))
 
#define GET_FUNCTION_NAME_CHECKED_FourParams(ClassName, FunctionName, ArgType1, ArgType2, ArgType3, ArgType4)    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType3)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType4)>()), (int)0)), FName(TEXT(#FunctionName)))
 
#define GET_FUNCTION_NAME_STRING_CHECKED_OneParam(ClassName, FunctionName, ArgType)    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType)>()), (int)0)), TEXT(#FunctionName))
 
#define GET_FUNCTION_NAME_STRING_CHECKED_TwoParams(ClassName, FunctionName, ArgType1, ArgType2)    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>()), (int)0)), TEXT(#FunctionName))
 
#define GET_FUNCTION_NAME_STRING_CHECKED_ThreeParams(ClassName, FunctionName, ArgType1, ArgType2, ArgType3)    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType3)>()), (int)0)), TEXT(#FunctionName))
 
#define GET_FUNCTION_NAME_STRING_CHECKED_FourParams(ClassName, FunctionName, ArgType1, ArgType2, ArgType3, ArgType4)    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType3)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType4)>()), (int)0)), TEXT(#FunctionName))
 
#define LowLevelFatalError(Format, ...)
 

Functions

void PrintScriptCallstack ()
 
template<typename RetType = void, class InnerType , typename... ArgTypes>
RetType FORCENOINLINE UE_DEBUG_SECTION DispatchCheckVerify (InnerType &&Inner, ArgTypes const &... Args)
 
template<typename T >
bool UEAsserts_Private::GetMemberNameCheckedJunk (const T &)
 
template<typename T >
bool UEAsserts_Private::GetMemberNameCheckedJunk (const volatile T &)
 
template<typename R , typename ... Args>
bool UEAsserts_Private::GetMemberNameCheckedJunk (R(*)(Args...))
 
void VARARGS LowLevelFatalErrorHandler (const ANSICHAR *File, int32 Line, void *ProgramCounter, const TCHAR *Format=TEXT(""),...)
 

Variables

TFunction< bool(const FEnsureHandlerArgs &Args) SetEnsureHandler )(TFunction< bool(const FEnsureHandlerArgs &Args)> EnsureHandler)
 
TFunction< bool(const FEnsureHandlerArgs &Args) GetEnsureHandler )()
 
bool GIgnoreDebugger
 

Macro Definition Documentation

◆ _DebugBreakAndPromptForRemote

#define _DebugBreakAndPromptForRemote ( )     UE_DEPRECATED_MACRO(5.1, "Use UE_DEBUG_BREAK_AND_PROMPT_FOR_REMOTE.")

Definition at line 198 of file AssertionMacros.h.

◆ check

#define check ( expr)    { CA_ASSUME(expr); }

Definition at line 305 of file AssertionMacros.h.

◆ checkCode

#define checkCode ( ...)

Definition at line 304 of file AssertionMacros.h.

◆ checkf

#define checkf ( expr,
format,
... )   { CA_ASSUME(expr); }

Definition at line 306 of file AssertionMacros.h.

◆ checkfSlow

#define checkfSlow ( expr,
format,
... )   { CA_ASSUME(expr); }

Definition at line 324 of file AssertionMacros.h.

◆ checkNoEntry

#define checkNoEntry ( )

Definition at line 307 of file AssertionMacros.h.

◆ checkNoRecursion

#define checkNoRecursion ( )

Definition at line 309 of file AssertionMacros.h.

◆ checkNoReentry

#define checkNoReentry ( )

Definition at line 308 of file AssertionMacros.h.

◆ checkSlow

#define checkSlow ( expr)    { CA_ASSUME(expr); }

Definition at line 323 of file AssertionMacros.h.

◆ ensure

#define ensure ( InExpression)    (!!(InExpression))

ensure() can be used to test for non-fatal errors at runtime

Rather than crashing, an error report (with a full call stack) will be logged and submitted to the crash server. This is useful when you want runtime code verification but you're handling the error case anyway.

Note: ensure() can be nested within conditionals!

Example:

if (ensure(InObject != nullptr))
{
    InObject->Modify();
}

This code is safe to execute as the pointer dereference is wrapped in a non-nullptr conditional block, but you still want to find out if this ever happens so you can avoid side effects. Using ensure() here will force a crash report to be generated without crashing the application (and potentially causing editor users to lose unsaved work.)

ensure() resolves to just evaluate the expression when DO_CHECK is 0 (typically shipping or test builds).

By default a given call site will only print the callstack and submit the 'crash report' the first time an ensure is hit in a session; ensureAlways can be used instead if you want to handle every failure

Definition at line 381 of file AssertionMacros.h.

◆ ensureAlways

#define ensureAlways ( InExpression)    (!!(InExpression))

Definition at line 383 of file AssertionMacros.h.

◆ ensureAlwaysMsgf

#define ensureAlwaysMsgf ( InExpression,
InFormat,
... )   (!!(InExpression))

Definition at line 384 of file AssertionMacros.h.

◆ ensureMsgf

#define ensureMsgf ( InExpression,
InFormat,
... )   (!!(InExpression))

Definition at line 382 of file AssertionMacros.h.

◆ GET_ENUMERATOR_NAME_CHECKED

◆ GET_FUNCTION_NAME_CHECKED

#define GET_FUNCTION_NAME_CHECKED ( ClassName,
FunctionName )    ((void)sizeof(&ClassName::FunctionName), FName(TEXT(#FunctionName)))

Definition at line 411 of file AssertionMacros.h.

◆ GET_FUNCTION_NAME_CHECKED_FourParams

#define GET_FUNCTION_NAME_CHECKED_FourParams ( ClassName,
FunctionName,
ArgType1,
ArgType2,
ArgType3,
ArgType4 )    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType3)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType4)>()), (int)0)), FName(TEXT(#FunctionName)))

Definition at line 428 of file AssertionMacros.h.

◆ GET_FUNCTION_NAME_CHECKED_OneParam

#define GET_FUNCTION_NAME_CHECKED_OneParam ( ClassName,
FunctionName,
ArgType )    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType)>()), (int)0)), FName(TEXT(#FunctionName)))

Definition at line 419 of file AssertionMacros.h.

◆ GET_FUNCTION_NAME_CHECKED_ThreeParams

#define GET_FUNCTION_NAME_CHECKED_ThreeParams ( ClassName,
FunctionName,
ArgType1,
ArgType2,
ArgType3 )    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType3)>()), (int)0)), FName(TEXT(#FunctionName)))

Definition at line 425 of file AssertionMacros.h.

◆ GET_FUNCTION_NAME_CHECKED_TwoParams

#define GET_FUNCTION_NAME_CHECKED_TwoParams ( ClassName,
FunctionName,
ArgType1,
ArgType2 )    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>()), (int)0)), FName(TEXT(#FunctionName)))

Definition at line 422 of file AssertionMacros.h.

◆ GET_FUNCTION_NAME_STRING_CHECKED

#define GET_FUNCTION_NAME_STRING_CHECKED ( ClassName,
FunctionName )    ((void)sizeof(&ClassName::FunctionName), TEXT(#FunctionName))

Definition at line 414 of file AssertionMacros.h.

◆ GET_FUNCTION_NAME_STRING_CHECKED_FourParams

#define GET_FUNCTION_NAME_STRING_CHECKED_FourParams ( ClassName,
FunctionName,
ArgType1,
ArgType2,
ArgType3,
ArgType4 )    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType3)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType4)>()), (int)0)), TEXT(#FunctionName))

Definition at line 440 of file AssertionMacros.h.

◆ GET_FUNCTION_NAME_STRING_CHECKED_OneParam

#define GET_FUNCTION_NAME_STRING_CHECKED_OneParam ( ClassName,
FunctionName,
ArgType )    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType)>()), (int)0)), TEXT(#FunctionName))

Definition at line 431 of file AssertionMacros.h.

◆ GET_FUNCTION_NAME_STRING_CHECKED_ThreeParams

#define GET_FUNCTION_NAME_STRING_CHECKED_ThreeParams ( ClassName,
FunctionName,
ArgType1,
ArgType2,
ArgType3 )    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType3)>()), (int)0)), TEXT(#FunctionName))

Definition at line 437 of file AssertionMacros.h.

◆ GET_FUNCTION_NAME_STRING_CHECKED_TwoParams

#define GET_FUNCTION_NAME_STRING_CHECKED_TwoParams ( ClassName,
FunctionName,
ArgType1,
ArgType2 )    ((void)sizeof((std::declval<ClassName&>().FunctionName(std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType1)>(), std::declval<PREPROCESSOR_REMOVE_OPTIONAL_PARENS(ArgType2)>()), (int)0)), TEXT(#FunctionName))

Definition at line 434 of file AssertionMacros.h.

◆ GET_MEMBER_NAME_CHECKED

#define GET_MEMBER_NAME_CHECKED ( ClassName,
MemberName )    ((void)sizeof(UEAsserts_Private::GetMemberNameCheckedJunk(((ClassName*)0)->MemberName)), FName(TEXT(#MemberName)))

Definition at line 404 of file AssertionMacros.h.

◆ GET_MEMBER_NAME_STRING_CHECKED

#define GET_MEMBER_NAME_STRING_CHECKED ( ClassName,
MemberName )    ((void)sizeof(UEAsserts_Private::GetMemberNameCheckedJunk(((ClassName*)0)->MemberName)), TEXT(#MemberName))

Definition at line 407 of file AssertionMacros.h.

◆ LowLevelFatalError

#define LowLevelFatalError ( Format,
... )
Value:

Definition at line 450 of file AssertionMacros.h.

◆ PLATFORM_BREAK_IF_DESIRED

#define PLATFORM_BREAK_IF_DESIRED ( )    if (LIKELY(!GIgnoreDebugger)) { PLATFORM_BREAK(); }

Definition at line 204 of file AssertionMacros.h.

◆ UE_DEBUG_BREAK_AND_PROMPT_FOR_REMOTE

#define UE_DEBUG_BREAK_AND_PROMPT_FOR_REMOTE ( )     if (!FPlatformMisc::IsDebuggerPresent()) { FPlatformMisc::PromptForRemoteDebugging(false); } UE_DEBUG_BREAK();

Definition at line 192 of file AssertionMacros.h.

◆ UE_DEBUG_SECTION

#define UE_DEBUG_SECTION

Definition at line 27 of file AssertionMacros.h.

◆ unimplemented

#define unimplemented ( )    { CA_ASSUME(false); }

Definition at line 312 of file AssertionMacros.h.

◆ verifyf

#define verifyf ( expr,
format,
... )   { if(UNLIKELY(!(expr))){ CA_ASSUME(false); } }

Definition at line 311 of file AssertionMacros.h.

◆ verifySlow

#define verifySlow ( expr)    { if(UNLIKELY(!(expr))) { CA_ASSUME(false); } }

Definition at line 325 of file AssertionMacros.h.

Function Documentation

◆ DispatchCheckVerify()

template<typename RetType = void, class InnerType , typename... ArgTypes>
RetType FORCENOINLINE UE_DEBUG_SECTION DispatchCheckVerify ( InnerType && Inner,
ArgTypes const &... Args )

Definition at line 186 of file AssertionMacros.h.

◆ LowLevelFatalErrorHandler()

void VARARGS LowLevelFatalErrorHandler ( const ANSICHAR * File,
int32 Line,
void * ProgramCounter,
const TCHAR * Format = TEXT(""),
... )

low level fatal error handler.

◆ PrintScriptCallstack()

void PrintScriptCallstack ( )

C Exposed function to print the callstack to ease debugging needs. In an editor build you can call this in the Immediate Window by doing, {,,UnrealEditor-Core}PrintScriptCallstack()

Variable Documentation

◆ GetEnsureHandler

TFunction< bool(const FEnsureHandlerArgs &Args) GetEnsureHandler) () ( )

◆ GIgnoreDebugger

bool GIgnoreDebugger
extern

◆ SetEnsureHandler

Sets the thead_local ensure handler callback returning true skips the regular ensure handling logic returns the previous handler which maybe nullptr