6#if (defined(__AUTORTFM) && __AUTORTFM)
17#define AUTORTFM_VERBOSE_ENABLED 0
28#define AUTORTFM_INTERNAL [[clang::autortfm(internal)]]
61[[clang::preserve_most]]
67 if (ProgramCounter ==
nullptr)
79 if (ProgramCounter ==
nullptr)
110 if (ProgramCounter ==
nullptr)
121inline void EnsureFailure(const
char*
File,
int Line,
void* ProgramCounter, const
char* Condition, const
char*
Format, ...)
123 if (ProgramCounter ==
nullptr)
139 static_assert(std::is_integral_v<T>);
140 return Value & ~(Alignment - 1);
148 static_assert(std::is_integral_v<T>);
149 return (
Value + Alignment - 1) & ~(Alignment - 1);
157 static_assert(std::is_integral_v<T>);
166 static_assert(std::is_integral_v<T>);
172inline constexpr T
Lerp(T Start, T
End, T Fraction)
179#define AUTORTFM_LIKELY(x) __builtin_expect(!!(x), 1)
180#define AUTORTFM_UNLIKELY(x) __builtin_expect(!!(x), 0)
182#define AUTORTFM_REQUIRE_SEMICOLON static_assert(true)
184#define AUTORTFM_REPORT_ERROR(Format, ...) ::AutoRTFM::ReportError(__FILE__, __LINE__, nullptr, Format, ##__VA_ARGS__)
186#define AUTORTFM_VERBOSE(Format, ...) ::AutoRTFM::Log(__FILE__, __LINE__, nullptr, autortfm_log_verbose, Format, ##__VA_ARGS__)
187#define AUTORTFM_LOG(Format, ...) ::AutoRTFM::Log(__FILE__, __LINE__, nullptr, autortfm_log_info, Format, ##__VA_ARGS__)
188#define AUTORTFM_WARN(Format, ...) ::AutoRTFM::Log(__FILE__, __LINE__, nullptr, autortfm_log_warn, Format, ##__VA_ARGS__)
189#define AUTORTFM_ERROR(Format, ...) ::AutoRTFM::Log(__FILE__, __LINE__, nullptr, autortfm_log_error, Format, ##__VA_ARGS__)
190#define AUTORTFM_FATAL(Format, ...) ::AutoRTFM::Log(__FILE__, __LINE__, nullptr, autortfm_log_fatal, Format, ##__VA_ARGS__)
192#define AUTORTFM_VERBOSE_V(Format, Args) ::AutoRTFM::LogV(__FILE__, __LINE__, nullptr, autortfm_log_verbose, Format, Args)
193#define AUTORTFM_LOG_V(Format, Args) ::AutoRTFM::LogV(__FILE__, __LINE__, nullptr, autortfm_log_info, Format, Args)
194#define AUTORTFM_WARN_V(Format, Args) ::AutoRTFM::LogV(__FILE__, __LINE__, nullptr, autortfm_log_warn, Format, Args)
195#define AUTORTFM_ERROR_V(Format, Args) ::AutoRTFM::LogV(__FILE__, __LINE__, nullptr, autortfm_log_error, Format, Args)
196#define AUTORTFM_FATAL_V(Format, Args) ::AutoRTFM::LogV(__FILE__, __LINE__, nullptr, autortfm_log_fatal, Format, Args)
198#define AUTORTFM_VERBOSE_IF(Condition, Format, ...) do { if (Condition) { AUTORTFM_VERBOSE(Format, ##__VA_ARGS__); } } while(false)
199#define AUTORTFM_LOG_IF(Condition, Format, ...) do { if (Condition) { AUTORTFM_LOG(Format, ##__VA_ARGS__); } } while(false)
200#define AUTORTFM_WARN_IF(Condition, Format, ...) do { if (Condition) { AUTORTFM_WARN(Format, ##__VA_ARGS__); } } while(false)
201#define AUTORTFM_ERROR_IF(Condition, Format, ...) do { if (AUTORTFM_UNLIKELY(Condition)) { AUTORTFM_ERROR(Format, ##__VA_ARGS__); } } while(false)
202#define AUTORTFM_FATAL_IF(Condition, Format, ...) do { if (AUTORTFM_UNLIKELY(Condition)) { AUTORTFM_FATAL(Format, ##__VA_ARGS__); } } while(false)
206#if !AUTORTFM_VERBOSE_ENABLED
207#undef AUTORTFM_VERBOSE
208#undef AUTORTFM_VERBOSE_V
209#undef AUTORTFM_VERBOSE_IF
210#define AUTORTFM_VERBOSE(...) AUTORTFM_REQUIRE_SEMICOLON
211#define AUTORTFM_VERBOSE_V(...) AUTORTFM_REQUIRE_SEMICOLON
212#define AUTORTFM_VERBOSE_IF(...) AUTORTFM_REQUIRE_SEMICOLON
215#define AUTORTFM_ENSURE(Condition) do { \
216 if (AUTORTFM_UNLIKELY(!(Condition))) { \
217 [[maybe_unused]] static bool bCalled = [] { \
218 ::AutoRTFM::EnsureFailure(__FILE__, __LINE__, nullptr, #Condition, nullptr); \
223#define AUTORTFM_ENSURE_MSG(Condition, Format, ...) do { \
224 if (AUTORTFM_UNLIKELY(!(Condition))) { \
225 [[maybe_unused]] static bool bCalled = [&] { \
226 ::AutoRTFM::EnsureFailure(__FILE__, __LINE__, nullptr, #Condition, Format, ##__VA_ARGS__); \
231#define AUTORTFM_ENSURE_MSG_V(Condition, Format, Args) do { \
232 if (AUTORTFM_UNLIKELY(!(Condition))) { \
233 [[maybe_unused]] static bool bCalled = [&] { \
234 ::AutoRTFM::EnsureFailureV(__FILE__, __LINE__, nullptr, #Condition, Format, Args); \
239#define AUTORTFM_DUMP_STACKTRACE(Message, ...) ::AutoRTFM::LogWithCallstack(autortfm_log_error, Message, ##__VA_ARGS__)
253#define AUTORTFM_ASSERT(exp) \
254 if (AUTORTFM_UNLIKELY(!(exp))) \
258 AUTORTFM_FATAL("AUTORTFM_ASSERT(%s) failure", #exp); \
260 AutoRTFM::DoAssert(Lambda); \
267#if AUTORTFM_BUILD_SHIPPING || AUTORTFM_BUILD_TEST
268#define AUTORTFM_ASSERT_DEBUG(exp) ((void)AUTORTFM_LIKELY(static_cast<bool>(exp)))
270#define AUTORTFM_ASSERT_DEBUG(exp) \
271 if (AUTORTFM_UNLIKELY(!(exp))) \
275 AUTORTFM_FATAL("AUTORTFM_ASSERT_DEBUG(%s) failure", #exp); \
277 AutoRTFM::DoAssert(Lambda); \
283#define AUTORTFM_EXPECT(exp) \
284 if (AUTORTFM_UNLIKELY(!(exp))) \
288 ::AutoRTFM::LogWithCallstack(autortfm_log_info, "AUTORTFM_EXPECT(%s) failure", #exp); \
290 AutoRTFM::DoExpect(Lambda); \
293#if defined(__has_feature)
294#if __has_feature(address_sanitizer)
295#define AUTORTFM_NO_ASAN [[clang::no_sanitize("address")]]
299#if !defined(AUTORTFM_NO_ASAN)
300#define AUTORTFM_NO_ASAN
303#if defined(__clang__)
304#define AUTORTFM_MUST_TAIL [[clang::musttail]]
307#if !defined(AUTORTFM_MUST_TAIL)
308#define AUTORTFM_MUST_TAIL
311#if !defined(CA_SUPPRESS)
312#define CA_SUPPRESS( WarningNumber )
315[[
noreturn]]
inline void AutoRTFM::InternalUnreachable()
constexpr T AlignDown(T Val, uint64 Alignment)
Definition AlignmentTemplates.h:34
#define UE_AUTORTFM_FORCENOINLINE
Definition AutoRTFMDefines.h:173
#define AUTORTFM_DISABLE
Definition AutoRTFMDefines.h:116
#define UE_AUTORTFM_API
Definition AutoRTFMDefines.h:156
autortfm_log_severity
Definition AutoRTFM.h:77
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
float swift_float2 __attribute__((__ext_vector_type__(2)))
Definition MarketplaceKitWrapper.h:67
@ Start
Definition GeoEnum.h:100
@ Multiple
[PropertyMetadata] Used for numeric properties. Stipulates that the value must be a multiple of the m...
Definition ObjectMacros.h:1446
ULANG_FORCEINLINE constexpr T AlignUp(T Val, uint64_t Alignment)
Definition Storage.h:93