Kaynağa Gözat

DPF on llvm_assert. (#1115)

Tex Riddell 7 yıl önce
ebeveyn
işleme
571ff78e00

+ 1 - 1
include/dxc/Support/Global.h

@@ -187,7 +187,7 @@ inline void OutputDebugFormatA(_In_ _Printf_format_string_ _Null_terminated_ con
 //
 #define DXASSERT(exp, fmt, ...)\
   do { _Analysis_assume_(exp); if(!(exp)) {                              \
-    OutputDebugFormatA("Error: \t%s\t\nFile:\n%s(%d)\t\nFunc:\t%s.\n\t" fmt "\n", "!(" #exp ")", __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); \
+    OutputDebugFormatA("Error: \t%s\nFile:\n%s(%d)\nFunc:\t%s.\n\t" fmt "\n", "!(" #exp ")", __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); \
     __debugbreak();\
   } } while(0)
 

+ 3 - 2
include/llvm/llvm_assert/assert.h

@@ -33,12 +33,13 @@ extern "C" {
 #endif
 void llvm_assert(const char *_Message,
                  const char *_File,
-                 unsigned _Line);
+                 unsigned _Line,
+                 const char *_Function);
 #ifdef __cplusplus
 }
 #endif
 
-#define assert(_Expression) ((void)( (!!(_Expression)) || (llvm_assert(#_Expression, __FILE__, __LINE__), 0) ))
+#define assert(_Expression) ((void)( (!!(_Expression)) || (llvm_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) ))
 
 #endif  /* NDEBUG */
 

+ 4 - 1
lib/Support/assert.cpp

@@ -9,9 +9,12 @@
 
 #include "assert.h"
 #include "windows.h"
+#include "dxc/Support/Global.h"
 
 void llvm_assert(_In_z_ const char *_Message,
                  _In_z_ const char *_File,
-                 _In_ unsigned _Line) {
+                 _In_ unsigned _Line,
+                 const char *_Function) {
+  OutputDebugFormatA("Error: assert(%s)\nFile:\n%s(%d)\nFunc:\t%s\n", _Message, _File, _Line, _Function);
   RaiseException(STATUS_LLVM_ASSERT, 0, 0, 0);
 }