diff gen/classes.cpp @ 315:a9697749e898 trunk

[svn r336] Made sure calls within a landing pad area are invokes. Nested trys still need some consideration.
author ChristianK
date Thu, 03 Jul 2008 22:05:45 +0200
parents d59c363fccad
children 781af50846b2
line wrap: on
line diff
--- a/gen/classes.cpp	Wed Jul 02 22:20:18 2008 +0200
+++ b/gen/classes.cpp	Thu Jul 03 22:05:45 2008 +0200
@@ -803,14 +803,14 @@
         llvm::Function* fn = newexp->allocator->ir.irFunc->func;
         assert(fn);
         DValue* arg = ((Expression*)newexp->newargs->data[0])->toElem(gIR);
-        mem = gIR->ir->CreateCall(fn, arg->getRVal(), "newclass_custom_alloc");
+        mem = gIR->CreateCallOrInvoke(fn, arg->getRVal(), "newclass_custom_alloc")->get();
         mem = DtoBitCast(mem, DtoType(tc), "newclass_custom");
     }
     // default allocator
     else
     {
         llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_newclass");
-        mem = gIR->ir->CreateCall(fn, tc->sym->ir.irStruct->classInfo, "newclass_gc_alloc");
+        mem = gIR->CreateCallOrInvoke(fn, tc->sym->ir.irStruct->classInfo, "newclass_gc_alloc")->get();
         mem = DtoBitCast(mem, DtoType(tc), "newclass_gc");
     }
 
@@ -914,11 +914,11 @@
         if (fnarg && fnarg->llvmByVal)
             palist = palist.addAttr(i+2, llvm::ParamAttr::ByVal); // return,this is 2
     }
-    llvm::CallInst* call = llvm::CallInst::Create(fn, ctorargs.begin(), ctorargs.end(), "tmp", gIR->scopebb());
+    CallOrInvoke* call = gIR->CreateCallOrInvoke(fn, ctorargs.begin(), ctorargs.end(), "tmp");
     call->setCallingConv(DtoCallingConv(LINKd));
     call->setParamAttrs(palist);
 
-    return new DImValue(type, call, false);
+    return new DImValue(type, call->get(), false);
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -931,7 +931,7 @@
     LLSmallVector<LLValue*,1> arg;
     arg.push_back(DtoBitCast(inst, fn->getFunctionType()->getParamType(0), ".tmp"));
     // call
-    llvm::CallInst::Create(fn, arg.begin(), arg.end(), "", gIR->scopebb());
+    gIR->CreateCallOrInvoke(fn, arg.begin(), arg.end(), "");
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -1016,7 +1016,7 @@
     assert(funcTy->getParamType(1) == cinfo->getType());
 
     // call it
-    LLValue* ret = gIR->ir->CreateCall2(func, obj, cinfo, "tmp");
+    LLValue* ret = gIR->CreateCallOrInvoke2(func, obj, cinfo, "tmp")->get();
 
     // cast return value
     ret = DtoBitCast(ret, DtoType(_to));
@@ -1039,7 +1039,7 @@
     tmp = DtoBitCast(tmp, funcTy->getParamType(0));
 
     // call it
-    LLValue* ret = gIR->ir->CreateCall(func, tmp, "tmp");
+    LLValue* ret = gIR->CreateCallOrInvoke(func, tmp, "tmp")->get();
 
     // cast return value
     if (to != NULL)
@@ -1079,7 +1079,7 @@
     cinfo = DtoBitCast(cinfo, funcTy->getParamType(1));
 
     // call it
-    LLValue* ret = gIR->ir->CreateCall2(func, ptr, cinfo, "tmp");
+    LLValue* ret = gIR->CreateCallOrInvoke2(func, ptr, cinfo, "tmp")->get();
 
     // cast return value
     ret = DtoBitCast(ret, DtoType(_to));
@@ -1369,7 +1369,7 @@
         DtorDeclaration *d = (DtorDeclaration *)cd->dtors.data[i];
         DtoForceDeclareDsymbol(d);
         assert(d->ir.irFunc->func);
-        builder.CreateCall(d->ir.irFunc->func, thisptr);
+        gIR->CreateCallOrInvoke(d->ir.irFunc->func, thisptr);
     }
     builder.CreateRetVoid();