[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
This commit is contained in:
David Majnemer 2015-04-01 04:45:52 +00:00
parent 5a9808b7ed
commit 1f192e26fd
2 changed files with 16 additions and 0 deletions

View File

@ -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();

View File

@ -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