[llvm-commits] CVS: llvm/runtime/GCCLibraries/libexception/c++-exception.h

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 26 23:51:01 PDT 2003


Changes in directory llvm/runtime/GCCLibraries/libexception:

c++-exception.h updated: 1.2 -> 1.3

---
Log message:

C++ify, add new get_cxx_exception function to convert from generic llvm_exceptions to llvm_cxx_exception's


---
Diffs of the changes:

Index: llvm/runtime/GCCLibraries/libexception/c++-exception.h
diff -u llvm/runtime/GCCLibraries/libexception/c++-exception.h:1.2 llvm/runtime/GCCLibraries/libexception/c++-exception.h:1.3
--- llvm/runtime/GCCLibraries/libexception/c++-exception.h:1.2	Tue Aug 26 18:46:53 2003
+++ llvm/runtime/GCCLibraries/libexception/c++-exception.h	Tue Aug 26 23:50:45 2003
@@ -10,8 +10,9 @@
 
 #include "exception.h"
 #include <typeinfo>
+#include <cassert>
 
-typedef struct llvm_cxx_exception {
+struct llvm_cxx_exception {
   /* TypeInfo - A pointer to the C++ std::type_info object for this exception
    * class.  This is required because the class may not be polymorphic.
    */
@@ -42,9 +43,12 @@
    * this structure without breaking binary compatibility.
    */
   llvm_exception BaseException;
-} llvm_cxx_exception;
-
+};
 
+inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) {
+  assert(E->ExceptionType == CXXException && "Not a C++ exception?");
+  return (llvm_cxx_exception*)(E+1)-1;
+}
 
 extern "C" {
   void *__llvm_cxxeh_allocate_exception(unsigned NumBytes);





More information about the llvm-commits mailing list