Modified: trunk/Source/WTF/wtf/Assertions.h (248929 => 248930)
--- trunk/Source/WTF/wtf/Assertions.h 2019-08-21 01:13:02 UTC (rev 248929)
+++ trunk/Source/WTF/wtf/Assertions.h 2019-08-21 01:36:41 UTC (rev 248930)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -549,6 +549,54 @@
#ifdef __cplusplus
+template<typename T>
+ALWAYS_INLINE uint64_t wtfCrashArg(T* arg) { return reinterpret_cast<uintptr_t>(arg); }
+
+template<typename T>
+ALWAYS_INLINE uint64_t wtfCrashArg(T arg) { return arg; }
+
+template<typename T>
+NO_RETURN_DUE_TO_CRASH ALWAYS_INLINE void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, T reason)
+{
+ WTFCrashWithInfo(line, file, function, counter, wtfCrashArg(reason));
+}
+
+template<typename T, typename U>
+NO_RETURN_DUE_TO_CRASH ALWAYS_INLINE void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, T reason, U misc1)
+{
+ WTFCrashWithInfo(line, file, function, counter, wtfCrashArg(reason), wtfCrashArg(misc1));
+}
+
+template<typename T, typename U, typename V>
+NO_RETURN_DUE_TO_CRASH ALWAYS_INLINE void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, T reason, U misc1, V misc2)
+{
+ WTFCrashWithInfo(line, file, function, counter, wtfCrashArg(reason), wtfCrashArg(misc1), wtfCrashArg(misc2));
+}
+
+template<typename T, typename U, typename V, typename W>
+NO_RETURN_DUE_TO_CRASH ALWAYS_INLINE void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, T reason, U misc1, V misc2, W misc3)
+{
+ WTFCrashWithInfo(line, file, function, counter, wtfCrashArg(reason), wtfCrashArg(misc1), wtfCrashArg(misc2), wtfCrashArg(misc3));
+}
+
+template<typename T, typename U, typename V, typename W, typename X>
+NO_RETURN_DUE_TO_CRASH ALWAYS_INLINE void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, T reason, U misc1, V misc2, W misc3, X misc4)
+{
+ WTFCrashWithInfo(line, file, function, counter, wtfCrashArg(reason), wtfCrashArg(misc1), wtfCrashArg(misc2), wtfCrashArg(misc3), wtfCrashArg(misc4));
+}
+
+template<typename T, typename U, typename V, typename W, typename X, typename Y>
+NO_RETURN_DUE_TO_CRASH ALWAYS_INLINE void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, T reason, U misc1, V misc2, W misc3, X misc4, Y misc5)
+{
+ WTFCrashWithInfo(line, file, function, counter, wtfCrashArg(reason), wtfCrashArg(misc1), wtfCrashArg(misc2), wtfCrashArg(misc3), wtfCrashArg(misc4), wtfCrashArg(misc5));
+}
+
+template<typename T, typename U, typename V, typename W, typename X, typename Y, typename Z>
+NO_RETURN_DUE_TO_CRASH ALWAYS_INLINE void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, T reason, U misc1, V misc2, W misc3, X misc4, Y misc5, Z misc6)
+{
+ WTFCrashWithInfo(line, file, function, counter, wtfCrashArg(reason), wtfCrashArg(misc1), wtfCrashArg(misc2), wtfCrashArg(misc3), wtfCrashArg(misc4), wtfCrashArg(misc5), wtfCrashArg(misc6));
+}
+
// The combination of line, file, function, and counter should be a unique number per call to this crash. This tricks the compiler into not coalescing calls to WTFCrashWithInfo.
// The easiest way to fill these values per translation unit is to pass __LINE__, __FILE__, WTF_PRETTY_FUNCTION, and __COUNTER__.
WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH NOT_TAIL_CALLED void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, uint64_t reason, uint64_t misc1, uint64_t misc2, uint64_t misc3, uint64_t misc4, uint64_t misc5, uint64_t misc6);
@@ -569,13 +617,13 @@
}
namespace WTF {
-inline void isIntegralType() { }
+inline void isIntegralOrPointerType() { }
template<typename T, typename... Types>
-void isIntegralType(T, Types... types)
+void isIntegralOrPointerType(T, Types... types)
{
- static_assert(std::is_integral<T>::value || std::is_enum<T>::value, "All types need to be integral bitwise_cast to integral type for logging");
- isIntegralType(types...);
+ static_assert(std::is_integral<T>::value || std::is_enum<T>::value || std::is_pointer<T>::value, "All types need to be bitwise_cast-able to integral type for logging");
+ isIntegralOrPointerType(types...);
}
}
@@ -593,7 +641,7 @@
// crashWithInfo functions below.
#if COMPILER(CLANG) || COMPILER(MSVC)
#define CRASH_WITH_INFO(...) do { \
- WTF::isIntegralType(__VA_ARGS__); \
+ WTF::isIntegralOrPointerType(__VA_ARGS__); \
compilerFenceForCrash(); \
WTFCrashWithInfo(__LINE__, __FILE__, WTF_PRETTY_FUNCTION, __COUNTER__, ##__VA_ARGS__); \
} while (false)