summaryrefslogtreecommitdiff
path: root/exception.cc
diff options
context:
space:
mode:
authorDavid Chisnall <theraven@FreeBSD.org>2012-03-20 17:41:02 +0000
committerDavid Chisnall <theraven@FreeBSD.org>2012-03-20 17:41:02 +0000
commit60e0399a08860d0c676dd35b09a8c2c21610b5a7 (patch)
tree24dc4c5496988aac4a06cf27afa74cc23f5bf787 /exception.cc
parentc28183e9401bafa52f68dea663e844d11a4662c4 (diff)
Notes
Diffstat (limited to 'exception.cc')
-rw-r--r--exception.cc47
1 files changed, 6 insertions, 41 deletions
diff --git a/exception.cc b/exception.cc
index 8cbcb978eb9fd..fe56297f9dd53 100644
--- a/exception.cc
+++ b/exception.cc
@@ -847,14 +847,11 @@ static bool check_type_signature(__cxa_exception *ex,
const std::type_info *type,
void *&adjustedPtr)
{
- // TODO: For compatibility with the GNU implementation, we should move this
- // out into a __do_catch() virtual function in std::type_info
void *exception_ptr = (void*)(ex+1);
- const std::type_info *ex_type = ex->exceptionType;
+ const std::type_info *ex_type = ex->exceptionType;
- const __pointer_type_info *ptr_type =
- dynamic_cast<const __pointer_type_info*>(ex_type);
- if (0 != ptr_type)
+ bool is_ptr = ex_type->__is_pointer_p();
+ if (is_ptr)
{
exception_ptr = *(void**)exception_ptr;
}
@@ -862,11 +859,6 @@ static bool check_type_signature(__cxa_exception *ex,
//
// Note: A 0 here is a catchall, not a cleanup, so we return true to
// indicate that we found a catch.
- //
- // TODO: Provide a class for matching against foreign exceptions. This is
- // already done in libobjc2, allowing C++ exceptions to be boxed as
- // Objective-C objects. We should do something similar, allowing foreign
- // exceptions to be wrapped in a C++ exception and delivered.
if (0 == type)
{
if (ex)
@@ -878,28 +870,6 @@ static bool check_type_signature(__cxa_exception *ex,
if (0 == ex) { return false; }
- const __pointer_type_info *target_ptr_type =
- dynamic_cast<const __pointer_type_info*>(type);
-
- if (0 != ptr_type && 0 != target_ptr_type)
- {
- if (ptr_type->__flags & ~target_ptr_type->__flags)
- {
- // Handler pointer is less qualified
- return false;
- }
-
- // Special case for void* handler.
- if(*target_ptr_type->__pointee == typeid(void))
- {
- adjustedPtr = exception_ptr;
- return true;
- }
-
- ex_type = ptr_type->__pointee;
- type = target_ptr_type->__pointee;
- }
-
// If the types are the same, no casting is needed.
if (*type == *ex_type)
{
@@ -907,18 +877,13 @@ static bool check_type_signature(__cxa_exception *ex,
return true;
}
- const __class_type_info *cls_type =
- dynamic_cast<const __class_type_info*>(ex_type);
- const __class_type_info *target_cls_type =
- dynamic_cast<const __class_type_info*>(type);
- if (0 != cls_type &&
- 0 != target_cls_type &&
- cls_type->can_cast_to(target_cls_type))
+ if (type->__do_catch(ex_type, &exception_ptr, 1))
{
- adjustedPtr = cls_type->cast_to(exception_ptr, target_cls_type);
+ adjustedPtr = exception_ptr;
return true;
}
+
return false;
}
/**