summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-02-11 00:00:21 +0000
committerReid Kleckner <reid@kleckner.net>2015-02-11 00:00:21 +0000
commite7b3f7c70d31ec34534586d2259868639c8fe175 (patch)
tree04a1e1b29f8becd64cbe2d4f0d6d3461b30de174 /clang/lib/CodeGen
parentbe6d1e49b0c58b5a28f0c8ca1e536c1157ca5666 (diff)
downloadbcm5719-llvm-e7b3f7c70d31ec34534586d2259868639c8fe175.tar.gz
bcm5719-llvm-e7b3f7c70d31ec34534586d2259868639c8fe175.zip
Emit landing pads for SEH even if nounwind is present
Disabling exceptions applies nounwind to lots of functions. SEH catches asynch exceptions, so emit the landing pad anyway. llvm-svn: 228769
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp3
-rw-r--r--clang/lib/CodeGen/CGException.cpp3
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h5
3 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 95fad1a1143..0574a1a34dc 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3304,7 +3304,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
llvm::BasicBlock *InvokeDest = nullptr;
if (!Attrs.hasAttribute(llvm::AttributeSet::FunctionIndex,
- llvm::Attribute::NoUnwind))
+ llvm::Attribute::NoUnwind) ||
+ currentFunctionUsesSEHTry())
InvokeDest = getInvokeDest();
llvm::CallSite CS;
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp
index 5ddd3bbb82b..a632a40e14a 100644
--- a/clang/lib/CodeGen/CGException.cpp
+++ b/clang/lib/CodeGen/CGException.cpp
@@ -743,8 +743,7 @@ llvm::BasicBlock *CodeGenFunction::getInvokeDestImpl() {
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;
}
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index f6e2bae3195..998e0676cd2 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -1122,6 +1122,11 @@ public:
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(); }
OpenPOWER on IntegriCloud