[llvm-branch-commits] [llvm] d8a6dea - Fix MSVC build with C++ EH enabled

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 12 02:21:19 PST 2020


Author: Reid Kleckner
Date: 2020-02-12T11:20:56+01:00
New Revision: d8a6deab7a84a559a1ff9f2196dae68870af80bf

URL: https://github.com/llvm/llvm-project/commit/d8a6deab7a84a559a1ff9f2196dae68870af80bf
DIFF: https://github.com/llvm/llvm-project/commit/d8a6deab7a84a559a1ff9f2196dae68870af80bf.diff

LOG: 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 a349c09162a8260bdf691c4f7ab72a16c33975f6)

Added: 
    

Modified: 
    llvm/lib/Support/CrashRecoveryContext.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp
index f708da773f4c..356835609830 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -41,7 +41,7 @@ struct CrashRecoveryContextImpl {
   unsigned ValidJumpBuffer : 1;
 
 public:
-  CrashRecoveryContextImpl(CrashRecoveryContext *CRC)
+  CrashRecoveryContextImpl(CrashRecoveryContext *CRC) noexcept
       : CRC(CRC), Failed(false), SwitchedThread(false), ValidJumpBuffer(false) {
     Next = CurrentContext->get();
     CurrentContext->set(this);


        


More information about the llvm-branch-commits mailing list