Added dependent exception support to __cxa_current_exception_type

llvm-svn: 146381
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 7fcad548360a6b9728de6844ddd0ea1807651a16
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index 6022740..9cf61a9 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -305,7 +305,11 @@
     __cxa_exception *current_exception = globals->caughtExceptions;
     if (NULL == current_exception)
         return NULL;        //  No current exception
-//  TODO add stuff for dependent exceptions.
+    if (isDependentException(&current_exception->unwindHeader)) {
+        __cxa_dependent_exception* deh =
+            reinterpret_cast<__cxa_dependent_exception*>(current_exception + 1) - 1;
+        current_exception = static_cast<__cxa_exception*>(deh->primaryException) - 1;
+    }
     return current_exception->exceptionType;
 }
 
diff --git a/www/spec.html b/www/spec.html
index a391a8d..dbc8fcb 100644
--- a/www/spec.html
+++ b/www/spec.html
@@ -189,9 +189,9 @@
 </p>
 </blockquote>
 </td>
-<td></td>
-<td></td>
-<td></td>
+<td>&#10003;</td>
+<td>&#10003;</td>
+<td>&#10003;</td>
 </tr>
 
 <tr>
@@ -206,9 +206,9 @@
 </p>
 </blockquote>
 </td>
-<td></td>
-<td></td>
-<td></td>
+<td>&#10003;</td>
+<td>&#10003;</td>
+<td>&#10003;</td>
 </tr>
 
 <tr>