[llvm-commits] [125901] Improve support for exception handling, patch by Duncan Sands.

clattner at apple.com clattner at apple.com
Sun Apr 8 18:28:19 PDT 2007


Revision: 125901
Author:   clattner
Date:     2007-04-08 18:28:18 -0700 (Sun, 08 Apr 2007)

Log Message:
-----------
Improve support for exception handling, patch by Duncan Sands.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-convert.cpp
    apple-local/branches/llvm/gcc/llvm-internal.h

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp	2007-04-08 18:39:16 UTC (rev 125900)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp	2007-04-09 01:28:18 UTC (rev 125901)
@@ -644,9 +644,12 @@
                    &Args[0], Args.size(), "",
                    CurBB);
       new UnreachableInst(CurBB);
+    } else {
+      new UnwindInst(UnwindBB);
     }
+#else
+    new UnwindInst(UnwindBB);
 #endif
-    new UnwindInst(UnwindBB);
   }
   
   // If this function takes the address of a label, emit the indirect goto
@@ -1922,20 +1925,16 @@
   FuncEHGetTypeID = Intrinsic::getDeclaration(TheModule,
                                               Intrinsic::eh_typeid_for);
                                                       
-  FuncCPPPersonality = cast<Function>(
+  FuncCPPPersonality =
     TheModule->getOrInsertFunction("__gxx_personality_v0",
                                    Type::getPrimitiveType(Type::VoidTyID),
-                                   NULL));
-  FuncCPPPersonality->setLinkage(Function::ExternalLinkage);
-  FuncCPPPersonality->setCallingConv(CallingConv::C);
+                                   NULL);
 
-  FuncUnwindResume = cast<Function>(
+  FuncUnwindResume =
     TheModule->getOrInsertFunction("_Unwind_Resume",
                                    Type::getPrimitiveType(Type::VoidTyID),
                                    PointerType::get(Type::Int8Ty),
-                                   NULL));
-  FuncUnwindResume->setLinkage(Function::ExternalLinkage);
-  FuncUnwindResume->setCallingConv(CallingConv::C);
+                                   NULL);
 
 }
 
@@ -2160,6 +2159,7 @@
       tree TypeInfoNopExpr = (*lang_eh_runtime_type)(TREE_VALUE(Types));
       // Produce value.  Duplicate typeinfo get folded here.
       Value *TypeInfo = Emit(TypeInfoNopExpr, 0);
+      TypeInfo = BitCastToType(TypeInfo, PointerType::get(Type::Int8Ty));
 
       // Call get eh type id.
       std::vector<Value*> Args;

Modified: apple-local/branches/llvm/gcc/llvm-internal.h
===================================================================
--- apple-local/branches/llvm/gcc/llvm-internal.h	2007-04-08 18:39:16 UTC (rev 125900)
+++ apple-local/branches/llvm/gcc/llvm-internal.h	2007-04-09 01:28:18 UTC (rev 125901)
@@ -273,11 +273,11 @@
   
   /// FuncCPPPersonality - Function handling c++ personality.
   ///
-  Function *FuncCPPPersonality;
+  Value *FuncCPPPersonality;
   
   /// FuncUnwindResume - Function used to continue exception unwinding.
   ///
-  Function *FuncUnwindResume;
+  Value *FuncUnwindResume;
   
   /// FinallyStack - Stack for nested try exit points.
   ///





More information about the llvm-commits mailing list