[cfe-commits] [libcxxabi] r149518 - in /libcxxabi/trunk/src: cxa_exception.cpp cxa_exception.hpp cxa_handlers.cpp cxa_personality.cpp

Howard Hinnant hhinnant at apple.com
Wed Feb 1 10:15:15 PST 2012


Author: hhinnant
Date: Wed Feb  1 12:15:15 2012
New Revision: 149518

URL: http://llvm.org/viewvc/llvm-project?rev=149518&view=rev
Log:
Treat all exceptions except that the ones that this library throws as foreign.  Even other C++ exceptions.

Modified:
    libcxxabi/trunk/src/cxa_exception.cpp
    libcxxabi/trunk/src/cxa_exception.hpp
    libcxxabi/trunk/src/cxa_handlers.cpp
    libcxxabi/trunk/src/cxa_personality.cpp

Modified: libcxxabi/trunk/src/cxa_exception.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=149518&r1=149517&r2=149518&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_exception.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception.cpp Wed Feb  1 12:15:15 2012
@@ -82,8 +82,8 @@
 
 //  Is it one of ours?
 static bool isOurExceptionClass(const _Unwind_Exception* unwind_exception) {
-    return (unwind_exception->exception_class & get_language) == 
-           (kOurExceptionClass                & get_language);
+    return (unwind_exception->exception_class & get_vendor_and_language) == 
+           (kOurExceptionClass                & get_vendor_and_language);
 }
 
 static bool isDependentException(_Unwind_Exception* unwind_exception) {

Modified: libcxxabi/trunk/src/cxa_exception.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.hpp?rev=149518&r1=149517&r2=149518&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_exception.hpp (original)
+++ libcxxabi/trunk/src/cxa_exception.hpp Wed Feb  1 12:15:15 2012
@@ -19,7 +19,7 @@
 
 static const uint64_t kOurExceptionClass          = 0x434C4E47432B2B00; // CLNGC++\0
 static const uint64_t kOurDependentExceptionClass = 0x434C4E47432B2B01; // CLNGC++\1
-static const uint64_t get_language =                0x00000000FFFFFF00; // mask for C++
+static const uint64_t get_vendor_and_language =     0xFFFFFFFFFFFFFF00; // mask for CLNGC++
                                                     
     struct __cxa_exception { 
 #if __LP64__

Modified: libcxxabi/trunk/src/cxa_handlers.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_handlers.cpp?rev=149518&r1=149517&r2=149518&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_handlers.cpp (original)
+++ libcxxabi/trunk/src/cxa_handlers.cpp Wed Feb  1 12:15:15 2012
@@ -37,8 +37,9 @@
         {
             _Unwind_Exception* unwind_exception =
                 reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1;
-            bool native_exception = (unwind_exception->exception_class   & get_language) == 
-                                                     (kOurExceptionClass & get_language);
+            bool native_exception =
+                (unwind_exception->exception_class   & get_vendor_and_language) == 
+                                 (kOurExceptionClass & get_vendor_and_language);
             if (native_exception)
             {
                 void* thrown_object =
@@ -167,8 +168,9 @@
         {
             _Unwind_Exception* unwind_exception =
                 reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1;
-            bool native_exception = (unwind_exception->exception_class & get_language) ==
-                                                   (kOurExceptionClass & get_language);
+            bool native_exception =
+                (unwind_exception->exception_class & get_vendor_and_language) ==
+                               (kOurExceptionClass & get_vendor_and_language);
             if (native_exception)
             {
                 __cxa_exception* exception_header = (__cxa_exception*)(unwind_exception+1) - 1;

Modified: libcxxabi/trunk/src/cxa_personality.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=149518&r1=149517&r2=149518&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_personality.cpp (original)
+++ libcxxabi/trunk/src/cxa_personality.cpp Wed Feb  1 12:15:15 2012
@@ -784,8 +784,8 @@
 {
     if (version != 1 || unwind_exception == 0 || context == 0)
         return _URC_FATAL_PHASE1_ERROR;
-    bool native_exception = (exceptionClass     & get_language) ==
-                            (kOurExceptionClass & get_language);
+    bool native_exception = (exceptionClass     & get_vendor_and_language) ==
+                            (kOurExceptionClass & get_vendor_and_language);
     scan_results results;
     if (actions & _UA_SEARCH_PHASE)
     {
@@ -873,8 +873,9 @@
     if (unwind_exception == 0)
         call_terminate(false, unwind_exception);
     __cxa_begin_catch(unwind_exception);
-    bool native_old_exception = (unwind_exception->exception_class & get_language) ==
-                                (kOurExceptionClass                & get_language);
+    bool native_old_exception =
+        (unwind_exception->exception_class & get_vendor_and_language) ==
+        (kOurExceptionClass                & get_vendor_and_language);
     std::unexpected_handler u_handler;
     std::terminate_handler t_handler;
     __cxa_exception* old_exception_header = 0;
@@ -931,8 +932,8 @@
                 // This shouldn't be able to happen!
                 std::__terminate(t_handler);
             bool native_new_exception =
-                (new_exception_header->unwindHeader.exception_class & get_language) ==
-                                                (kOurExceptionClass & get_language);
+                (new_exception_header->unwindHeader.exception_class & get_vendor_and_language) ==
+                                                (kOurExceptionClass & get_vendor_and_language);
             void* adjustedPtr;
             if (native_new_exception && (new_exception_header != old_exception_header))
             {





More information about the cfe-commits mailing list