Disabling exceptions applies nounwind to lots of functions. SEH catches
asynch exceptions, so emit the landing pad anyway.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228769
91177308-0d34-0410-b5e6-
96231b3b80d8
llvm::BasicBlock *InvokeDest = nullptr;
if (!Attrs.hasAttribute(llvm::AttributeSet::FunctionIndex,
- llvm::Attribute::NoUnwind))
+ llvm::Attribute::NoUnwind) ||
+ currentFunctionUsesSEHTry())
InvokeDest = getInvokeDest();
llvm::CallSite CS;
if (!LO.Exceptions) {
if (!LO.Borland && !LO.MicrosoftExt)
return nullptr;
- const auto *FD = dyn_cast_or_null<FunctionDecl>(CurCodeDecl);
- if (!FD || !FD->usesSEHTry())
+ if (!currentFunctionUsesSEHTry())
return nullptr;
}
return getInvokeDestImpl();
}
+ bool currentFunctionUsesSEHTry() const {
+ const auto *FD = dyn_cast_or_null<FunctionDecl>(CurCodeDecl);
+ return FD && FD->usesSEHTry();
+ }
+
const TargetInfo &getTarget() const { return Target; }
llvm::LLVMContext &getLLVMContext() { return CGM.getLLVMContext(); }
// RUN: -o - -mconstructor-aliases -fcxx-exceptions -fexceptions | \
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CXXEH
// RUN: %clang_cc1 -std=c++11 -fblocks -fms-extensions %s -triple=x86_64-windows-msvc -emit-llvm \
-// RUN: -o - -mconstructor-aliases | \
+// RUN: -o - -mconstructor-aliases -O1 -disable-llvm-optzns | \
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=NOCXX
extern "C" void might_throw();