LLVMContext-ification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75072 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2009-07-08 23:50:31 +00:00
parent ab711cc593
commit c341f1c62d
2 changed files with 10 additions and 7 deletions

View File

@ -118,7 +118,8 @@ GlobalVariable::GlobalVariable(Module &M, const Type *Ty, bool constant,
const std::string &Name, const std::string &Name,
GlobalVariable *Before, bool ThreadLocal, GlobalVariable *Before, bool ThreadLocal,
unsigned AddressSpace) unsigned AddressSpace)
: GlobalValue(PointerType::get(Ty, AddressSpace), Value::GlobalVariableVal, : GlobalValue(M.getContext().getPointerType(Ty, AddressSpace),
Value::GlobalVariableVal,
OperandTraits<GlobalVariable>::op_begin(this), OperandTraits<GlobalVariable>::op_begin(this),
InitVal != 0, Link, Name), InitVal != 0, Link, Name),
isConstantGlobal(constant), isThreadLocalSymbol(ThreadLocal) { isConstantGlobal(constant), isThreadLocalSymbol(ThreadLocal) {

View File

@ -157,8 +157,8 @@ Constant *Module::getOrInsertFunction(const std::string &Name,
// If the function exists but has the wrong type, return a bitcast to the // If the function exists but has the wrong type, return a bitcast to the
// right type. // right type.
if (F->getType() != PointerType::getUnqual(Ty)) if (F->getType() != Context.getPointerTypeUnqual(Ty))
return ConstantExpr::getBitCast(F, PointerType::getUnqual(Ty)); return Context.getConstantExprBitCast(F, Context.getPointerTypeUnqual(Ty));
// Otherwise, we just found the existing function or a prototype. // Otherwise, we just found the existing function or a prototype.
return F; return F;
@ -206,7 +206,8 @@ Constant *Module::getOrInsertFunction(const std::string &Name,
va_end(Args); va_end(Args);
// Build the function type and chain to the other getOrInsertFunction... // Build the function type and chain to the other getOrInsertFunction...
return getOrInsertFunction(Name, FunctionType::get(RetTy, ArgTys, false), return getOrInsertFunction(Name,
Context.getFunctionType(RetTy, ArgTys, false),
AttributeList); AttributeList);
} }
@ -223,7 +224,8 @@ Constant *Module::getOrInsertFunction(const std::string &Name,
va_end(Args); va_end(Args);
// Build the function type and chain to the other getOrInsertFunction... // Build the function type and chain to the other getOrInsertFunction...
return getOrInsertFunction(Name, FunctionType::get(RetTy, ArgTys, false), return getOrInsertFunction(Name,
Context.getFunctionType(RetTy, ArgTys, false),
AttrListPtr::get((AttributeWithIndex *)0, 0)); AttrListPtr::get((AttributeWithIndex *)0, 0));
} }
@ -277,8 +279,8 @@ Constant *Module::getOrInsertGlobal(const std::string &Name, const Type *Ty) {
// If the variable exists but has the wrong type, return a bitcast to the // If the variable exists but has the wrong type, return a bitcast to the
// right type. // right type.
if (GV->getType() != PointerType::getUnqual(Ty)) if (GV->getType() != Context.getPointerTypeUnqual(Ty))
return ConstantExpr::getBitCast(GV, PointerType::getUnqual(Ty)); return Context.getConstantExprBitCast(GV, Context.getPointerTypeUnqual(Ty));
// Otherwise, we just found the existing function or a prototype. // Otherwise, we just found the existing function or a prototype.
return GV; return GV;