diff gen/classes.cpp @ 1535:61f12f4651b5

Don't use llvm::getGlobalContext() anymore
author Benjamin Kramer <benny.kra@gmail.com>
date Mon, 13 Jul 2009 20:16:15 +0200
parents 8ca25bd765a3
children d6e8d5db259f
line wrap: on
line diff
--- a/gen/classes.cpp	Mon Jul 13 12:17:58 2009 +0200
+++ b/gen/classes.cpp	Mon Jul 13 20:16:15 2009 +0200
@@ -211,7 +211,7 @@
 
     // monitor always defaults to zero
     tmp = DtoGEPi(dst,0,1,"monitor");
-    val = llvm::getGlobalContext().getNullValue(tmp->getType()->getContainedType(0));
+    val = gIR->context().getNullValue(tmp->getType()->getContainedType(0));
     DtoStore(val, tmp);
 
     // done?
@@ -262,7 +262,7 @@
     else if (to->ty == Tbool) {
         IF_LOG Logger::println("to bool");
         LLValue* llval = val->getRVal();
-        LLValue* zero = llvm::getGlobalContext().getNullValue(llval->getType());
+        LLValue* zero = gIR->context().getNullValue(llval->getType());
         return new DImValue(_to, gIR->ir->CreateICmpNE(llval, zero, "tmp"));
     }
     // class -> integer
@@ -326,8 +326,8 @@
             // Sure we could have jumped over the code above in this case, but
             // it's just a GEP and (maybe) a pointer-to-pointer BitCast, so it
             // should be pretty cheap and perfectly safe even if the original was null.
-            LLValue* isNull = gIR->ir->CreateICmpEQ(orig, llvm::getGlobalContext().getNullValue(orig->getType()), ".nullcheck");
-            v = gIR->ir->CreateSelect(isNull, llvm::getGlobalContext().getNullValue(ifType), v, ".interface");
+            LLValue* isNull = gIR->ir->CreateICmpEQ(orig, gIR->context().getNullValue(orig->getType()), ".nullcheck");
+            v = gIR->ir->CreateSelect(isNull, gIR->context().getNullValue(ifType), v, ".interface");
 
             // return r-value
             return new DImValue(_to, v);
@@ -602,7 +602,7 @@
     LLConstant* ptr;
 
     if (nvars == 0)
-        return llvm::getGlobalContext().getNullValue( arrayT );
+        return gIR->context().getNullValue( arrayT );
 
     // array type
     const llvm::ArrayType* arrTy = llvm::ArrayType::get(arrayInits[0]->getType(), nvars);