Fix MSVC build with C++ EH enabled
authorReid Kleckner <rnk@google.com>
Tue, 11 Feb 2020 23:50:27 +0000 (15:50 -0800)
committerReid Kleckner <rnk@google.com>
Tue, 11 Feb 2020 23:56:10 +0000 (15:56 -0800)
commita349c09162a8260bdf691c4f7ab72a16c33975f6
tree4afd9c0d7ca971d50056f3f18fb3531b244ec63d
parent2d3ecade3892fb0d0713350e06522a94734733b7
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.
llvm/lib/Support/CrashRecoveryContext.cpp