Index: base/logging.h |
diff --git a/base/logging.h b/base/logging.h |
index 6f30bcbe4f736f989bad178ac3d96ed70bf08943..13661a764436c132813c0dc46032714804d5262b 100644 |
--- a/base/logging.h |
+++ b/base/logging.h |
@@ -500,7 +500,23 @@ class CheckOpResult { |
#if defined(COMPILER_GCC) |
#define IMMEDIATE_CRASH() __builtin_trap() |
#elif defined(COMPILER_MSVC) |
+ |
+// Clang is cleverer about coalescing int3s, so we need to add a unique-ish |
+// instruction following the __debugbreak() to have it emit distinct locations |
+// for CHECKs rather than collapsing them all together. It would be nice to use |
+// a short intrinsic to do this (and perhaps have only one implementation for |
+// both clang and MSVC), however clang-cl currently does not support intrinsics |
+// here. Adding the nullptr store to the MSVC path adds unnecessary bloat. |
+// TODO(scottmg): Reinvestigate a short sequence that will work on both |
+// compilers once clang supports more intrinsics. See https://crbug.com/693713. |
+#if defined(__clang__) |
+#define IMMEDIATE_CRASH() \ |
+ (__debugbreak(), \ |
+ (void)(*reinterpret_cast<volatile unsigned char*>(0) = __COUNTER__)) |
Primiano Tucci (use gerrit)
2017/02/21 11:02:07
I arrived late on this. I had the same exact prob
|
+#else |
#define IMMEDIATE_CRASH() __debugbreak() |
+#endif // __clang__ |
+ |
#else |
#error Port |
#endif |