Skip to content

Commit d8a6dea

Browse files
rnkzmodem
authored andcommitted
Fix MSVC build with C++ EH enabled
Mark the CrashRecoveryContextImpl constructor noexcept, so that MSVC won't emit an unwind helper to clean up the allocation from `new` if the constructor throws an exception. Otherwise, MSVC complains: llvm\lib\Support\CrashRecoveryContext.cpp(220): error C2712: \ Cannot use __try in functions that require object unwinding The other simple fix would be to wrap `new` in a static helper or lambda. Users have reported that Tensorflow builds LLVM with /EHsc. (cherry picked from commit a349c09)
1 parent 3c94b27 commit d8a6dea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Support/CrashRecoveryContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct CrashRecoveryContextImpl {
4141
unsigned ValidJumpBuffer : 1;
4242

4343
public:
44-
CrashRecoveryContextImpl(CrashRecoveryContext *CRC)
44+
CrashRecoveryContextImpl(CrashRecoveryContext *CRC) noexcept
4545
: CRC(CRC), Failed(false), SwitchedThread(false), ValidJumpBuffer(false) {
4646
Next = CurrentContext->get();
4747
CurrentContext->set(this);

0 commit comments

Comments
 (0)