Skip to content

Commit 28a87e6

Browse files
authored
Merge pull request #6938 from hughbe/swift-crash
Use LLVM_BUILTIN_TRAP in swift::crash instead of our own solution
2 parents e8bd702 + 9b06a72 commit 28a87e6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

include/swift/Runtime/Debug.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <llvm/Support/Compiler.h>
2121
#include <stdint.h>
22+
#include "swift/Basic/Unreachable.h"
2223
#include "swift/Runtime/Config.h"
2324
#include "swift/Runtime/Metadata.h"
2425

@@ -70,13 +71,9 @@ LLVM_ATTRIBUTE_NORETURN
7071
LLVM_ATTRIBUTE_ALWAYS_INLINE // Minimize trashed registers
7172
static inline void crash(const char *message) {
7273
CRSetCrashLogMessage(message);
73-
// __builtin_trap() doesn't always do the right thing due to GCC compatibility
74-
#if defined(__i386__) || defined(__x86_64__)
75-
asm("int3");
76-
#else
77-
__builtin_trap();
78-
#endif
79-
__builtin_unreachable();
74+
75+
LLVM_BUILTIN_TRAP;
76+
swift_unreachable("Expected compiler to crash.");
8077
}
8178

8279
/// Report a corrupted type object.

0 commit comments

Comments
 (0)