diff gen/classes.cpp @ 1534:8ca25bd765a3

Build fix for the latest LLVMContext changes (LLVM r75445) This shouldn't break the build with older LLVM revs. We include LLVMContext.h in gen/llvm.h now to make the transition a little bit easier.
author Benjamin Kramer <benny.kra@gmail.com>
date Mon, 13 Jul 2009 12:17:58 +0200
parents 2292878925f4
children 61f12f4651b5
line wrap: on
line diff
--- a/gen/classes.cpp	Sat Jul 11 14:19:21 2009 +0200
+++ b/gen/classes.cpp	Mon Jul 13 12:17:58 2009 +0200
@@ -211,7 +211,7 @@
 
     // monitor always defaults to zero
     tmp = DtoGEPi(dst,0,1,"monitor");
-    val = llvm::Constant::getNullValue(tmp->getType()->getContainedType(0));
+    val = llvm::getGlobalContext().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 = LLConstant::getNullValue(llval->getType());
+        LLValue* zero = llvm::getGlobalContext().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, LLConstant::getNullValue(orig->getType()), ".nullcheck");
-            v = gIR->ir->CreateSelect(isNull, LLConstant::getNullValue(ifType), v, ".interface");
+            LLValue* isNull = gIR->ir->CreateICmpEQ(orig, llvm::getGlobalContext().getNullValue(orig->getType()), ".nullcheck");
+            v = gIR->ir->CreateSelect(isNull, llvm::getGlobalContext().getNullValue(ifType), v, ".interface");
 
             // return r-value
             return new DImValue(_to, v);
@@ -602,7 +602,7 @@
     LLConstant* ptr;
 
     if (nvars == 0)
-        return LLConstant::getNullValue( arrayT );
+        return llvm::getGlobalContext().getNullValue( arrayT );
 
     // array type
     const llvm::ArrayType* arrTy = llvm::ArrayType::get(arrayInits[0]->getType(), nvars);