diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-04-01 04:45:52 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-04-01 04:45:52 +0000 |
commit | 1f192e26fd5471035bee2a721340f2344873d625 (patch) | |
tree | cedd0d3bd0d46c579d84eef13b7e849372095b12 /clang | |
parent | 5a9808b7ed76e3e569ffac99396cd7406bfa5219 (diff) | |
download | bcm5719-llvm-1f192e26fd5471035bee2a721340f2344873d625.tar.gz bcm5719-llvm-1f192e26fd5471035bee2a721340f2344873d625.zip |
[MS ABI] Disregard restrictive exception specifications
MSVC treats all non-empty exception specifications the same way: all
exceptions are permitted. The .xdata tables provide a way to
efficiently lower exception specifications *but* this probably has to be
implemented as a catch-all/rethrow mechanism instead of the Itanium way.
This fixes PR23092.
llvm-svn: 233787
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 8 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 1925c57d1bd..f10d2e1ecc6 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -458,6 +458,10 @@ void CodeGenFunction::EmitStartEHSpec(const Decl *D) { EHStack.pushTerminate(); } } else if (EST == EST_Dynamic || EST == EST_DynamicNone) { + // TODO: Revisit exception specifications for the MS ABI. There is a way to + // encode these in an object file but MSVC doesn't do anything with it. + if (getTarget().getCXXABI().isMicrosoft()) + return; unsigned NumExceptions = Proto->getNumExceptions(); EHFilterScope *Filter = EHStack.pushFilter(NumExceptions); @@ -532,6 +536,10 @@ void CodeGenFunction::EmitEndEHSpec(const Decl *D) { EHStack.popTerminate(); } } else if (EST == EST_Dynamic || EST == EST_DynamicNone) { + // TODO: Revisit exception specifications for the MS ABI. There is a way to + // encode these in an object file but MSVC doesn't do anything with it. + if (getTarget().getCXXABI().isMicrosoft()) + return; EHFilterScope &filterScope = cast<EHFilterScope>(*EHStack.begin()); emitFilterDispatchBlock(*this, filterScope); EHStack.popFilter(); diff --git a/clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp b/clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp index f0e20334519..15edef3d131 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp @@ -96,3 +96,11 @@ extern "C" void catch_a_ref() { // WIN64: %[[eptr_i8:[^ ]*]] = bitcast %struct.A* %[[eptr]] to i8* // WIN64: call void @handle_exception(i8* %[[eptr_i8]]) // WIN64: call void @llvm.eh.endcatch() + +extern "C" void fn_with_exc_spec() throw(int) { + might_throw(); +} + +// WIN64-LABEL: define void @fn_with_exc_spec() +// WIN64: call void @might_throw() +// WIN64-NEXT: ret void |