diff options
| author | Reid Kleckner <reid@kleckner.net> | 2015-02-11 00:00:21 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2015-02-11 00:00:21 +0000 |
| commit | e7b3f7c70d31ec34534586d2259868639c8fe175 (patch) | |
| tree | 04a1e1b29f8becd64cbe2d4f0d6d3461b30de174 /clang | |
| parent | be6d1e49b0c58b5a28f0c8ca1e536c1157ca5666 (diff) | |
| download | bcm5719-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')
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 5 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/exceptions-seh.cpp | 2 |
4 files changed, 9 insertions, 4 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(); } diff --git a/clang/test/CodeGenCXX/exceptions-seh.cpp b/clang/test/CodeGenCXX/exceptions-seh.cpp index e76f0ea5c07..38d176b829f 100644 --- a/clang/test/CodeGenCXX/exceptions-seh.cpp +++ b/clang/test/CodeGenCXX/exceptions-seh.cpp @@ -2,7 +2,7 @@ // 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(); |

