Update for LLVM API change, and contextify a bunch of related stuff.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75705 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 4777bc7..7bed5bc 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -28,7 +28,7 @@
 {
   llvm::Constant *C = CGM.getObjCRuntime().GenerateConstantString(E);
   // FIXME: This bitcast should just be made an invariant on the Runtime.
-  return llvm::ConstantExpr::getBitCast(C, ConvertType(E->getType()));
+  return VMContext.getConstantExprBitCast(C, ConvertType(E->getType()));
 }
 
 /// Emit a selector.
@@ -179,7 +179,7 @@
       Builder.CreateBitCast(LoadObjCSelf(), Types.ConvertType(IdTy));
     llvm::Value *Offset = EmitIvarOffset(IMP->getClassInterface(), Ivar);
     llvm::Value *True =
-      llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 1);
+      VMContext.getConstantInt(Types.ConvertType(getContext().BoolTy), 1);
     CallArgList Args;
     Args.push_back(std::make_pair(RValue::get(SelfAsId), IdTy));
     Args.push_back(std::make_pair(RValue::get(CmdVal), Cmd->getType()));
@@ -262,9 +262,9 @@
       Builder.CreateBitCast(Builder.CreateLoad(Arg, "arg"),
                             Types.ConvertType(IdTy));
     llvm::Value *True =
-      llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 1);
+      VMContext.getConstantInt(Types.ConvertType(getContext().BoolTy), 1);
     llvm::Value *False =
-      llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 0);
+      VMContext.getConstantInt(Types.ConvertType(getContext().BoolTy), 0);
     CallArgList Args;
     Args.push_back(std::make_pair(RValue::get(SelfAsId), IdTy));
     Args.push_back(std::make_pair(RValue::get(CmdVal), Cmd->getType()));
@@ -471,7 +471,7 @@
                                 getContext().getPointerType(ItemsTy)));
   
   const llvm::Type *UnsignedLongLTy = ConvertType(getContext().UnsignedLongTy);
-  llvm::Constant *Count = llvm::ConstantInt::get(UnsignedLongLTy, NumItems);
+  llvm::Constant *Count = VMContext.getConstantInt(UnsignedLongLTy, NumItems);
   Args.push_back(std::make_pair(RValue::get(Count), 
                                 getContext().UnsignedLongTy));
   
@@ -488,7 +488,7 @@
   llvm::BasicBlock *SetStartMutations = createBasicBlock("setstartmutations");
   
   llvm::Value *Limit = Builder.CreateLoad(LimitPtr);
-  llvm::Value *Zero = getLLVMContext().getNullValue(UnsignedLongLTy);
+  llvm::Value *Zero = VMContext.getNullValue(UnsignedLongLTy);
 
   llvm::Value *IsZero = Builder.CreateICmpEQ(Limit, Zero, "iszero");
   Builder.CreateCondBr(IsZero, NoElements, SetStartMutations);
@@ -574,7 +574,7 @@
   
   // Increment the counter.
   Counter = Builder.CreateAdd(Counter, 
-                              llvm::ConstantInt::get(UnsignedLongLTy, 1));
+                              VMContext.getConstantInt(UnsignedLongLTy, 1));
   Builder.CreateStore(Counter, CounterPtr);
   
   llvm::BasicBlock *LoopEnd = createBasicBlock("loopend");
@@ -618,7 +618,7 @@
     LValue LV = EmitLValue(cast<Expr>(S.getElement()));
     
     // Set the value to null.
-    Builder.CreateStore(getLLVMContext().getNullValue(ConvertType(ElementTy)),
+    Builder.CreateStore(VMContext.getNullValue(ConvertType(ElementTy)),
                         LV.getAddress());
   }