Update to use new PointerType::getUnqual() api.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45081 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Christopher Lamb 2007-12-17 01:11:20 +00:00
Родитель cc8b7f9118
Коммит ddc23f3e6f
5 изменённых файлов: 19 добавлений и 13 удалений

Просмотреть файл

@ -113,7 +113,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
case Builtin::BI__builtin_va_start:
case Builtin::BI__builtin_va_end: {
Value *ArgValue = EmitScalarExpr(E->getArg(0));
const llvm::Type *DestType = llvm::PointerType::get(llvm::Type::Int8Ty);
const llvm::Type *DestType =
llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
if (ArgValue->getType() != DestType)
ArgValue = Builder.CreateBitCast(ArgValue, DestType,
ArgValue->getNameStart());

Просмотреть файл

@ -83,7 +83,7 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
switch (E->getStmtClass()) {
default: {
WarnUnsupported(E, "l-value expression");
llvm::Type *Ty = llvm::PointerType::get(ConvertType(E->getType()));
llvm::Type *Ty = llvm::PointerType::getUnqual(ConvertType(E->getType()));
return LValue::MakeAddr(llvm::UndefValue::get(Ty));
}
@ -220,11 +220,13 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
assert(Src.isScalar() && "Can't emit an agg store with this method");
// FIXME: Handle volatility etc.
const llvm::Type *SrcTy = Src.getScalarVal()->getType();
const llvm::Type *AddrTy =
cast<llvm::PointerType>(DstAddr->getType())->getElementType();
const llvm::PointerType *DstPtr = cast<llvm::PointerType>(DstAddr->getType());
const llvm::Type *AddrTy = DstPtr->getElementType();
unsigned AS = DstPtr->getAddressSpace();
if (AddrTy != SrcTy)
DstAddr = Builder.CreateBitCast(DstAddr, llvm::PointerType::get(SrcTy),
DstAddr = Builder.CreateBitCast(DstAddr,
llvm::PointerType::get(SrcTy, AS),
"storetmp");
Builder.CreateStore(Src.getScalarVal(), DstAddr);
}
@ -422,7 +424,10 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
const llvm::PointerType * BaseTy =
cast<llvm::PointerType>(BaseValue->getType());
if (FieldTy != BaseTy->getElementType()) {
V = Builder.CreateBitCast(V, llvm::PointerType::get(FieldTy), "tmp");
// FIXME: Need to get address space qualification of pointer
V = Builder.CreateBitCast(V,
llvm::PointerType::getUnqual(FieldTy),
"tmp");
}
}
return LValue::MakeAddr(V);

Просмотреть файл

@ -92,7 +92,7 @@ void AggExprEmitter::EmitAggregateCopy(llvm::Value *DestPtr,
assert(!Ty->isComplexType() && "Shouldn't happen for complex");
// Aggregate assignment turns into llvm.memcpy.
const llvm::Type *BP = llvm::PointerType::get(llvm::Type::Int8Ty);
const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
if (DestPtr->getType() != BP)
DestPtr = Builder.CreateBitCast(DestPtr, BP, "tmp");
if (SrcPtr->getType() != BP)

Просмотреть файл

@ -75,7 +75,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunctionDecl(const FunctionDecl *D,
}
// If the pointer type matches, just return it.
llvm::Type *PFTy = llvm::PointerType::get(Ty);
llvm::Type *PFTy = llvm::PointerType::getUnqual(Ty);
if (PFTy == F->getType()) return Entry = F;
// If this isn't a definition, just return it casted to the right type.
@ -132,7 +132,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFileVarDecl(const FileVarDecl *D,
}
// If the pointer type matches, just return it.
llvm::Type *PTy = llvm::PointerType::get(Ty);
llvm::Type *PTy = llvm::PointerType::getUnqual(Ty);
if (PTy == GV->getType()) return Entry = GV;
// If this isn't a definition, just return it casted to the right type.

Просмотреть файл

@ -178,11 +178,11 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
}
case Type::Pointer: {
const PointerType &P = cast<PointerType>(Ty);
return llvm::PointerType::get(ConvertType(P.getPointeeType()));
return llvm::PointerType::getUnqual(ConvertType(P.getPointeeType()));
}
case Type::Reference: {
const ReferenceType &R = cast<ReferenceType>(Ty);
return llvm::PointerType::get(ConvertType(R.getReferenceeType()));
return llvm::PointerType::getUnqual(ConvertType(R.getReferenceeType()));
}
case Type::VariableArray: {
@ -224,7 +224,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
// Struct return passes the struct byref.
if (!ResultType->isFirstClassType() && ResultType != llvm::Type::VoidTy) {
const llvm::Type *RType = llvm::PointerType::get(ResultType);
const llvm::Type *RType = llvm::PointerType::getUnqual(ResultType);
QualType RTy = Context.getPointerType(FP.getResultType());
TypeHolderMap.insert(std::make_pair(RTy.getTypePtr(),
llvm::PATypeHolder(RType)));
@ -355,7 +355,7 @@ void CodeGenTypes::DecodeArgumentTypes(const FunctionTypeProto &FTP,
ArgTys.push_back(Ty);
else {
QualType PTy = Context.getPointerType(FTP.getArgType(i));
const llvm::Type *PtrTy = llvm::PointerType::get(Ty);
const llvm::Type *PtrTy = llvm::PointerType::getUnqual(Ty);
TypeHolderMap.insert(std::make_pair(PTy.getTypePtr(),
llvm::PATypeHolder(PtrTy)));