Minor cleanup to use the ConvertTypeForMem helper.

llvm-svn: 51837
This commit is contained in:
Eli Friedman 2008-06-01 15:16:01 +00:00
parent 3b6dd58ee7
commit 149a57f7d4
1 changed files with 3 additions and 5 deletions

View File

@ -560,9 +560,7 @@ LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue,
if (Field->isBitField()) {
// FIXME: CodeGenTypes should expose a method to get the appropriate
// type for FieldTy (the appropriate type is ABI-dependent).
unsigned EltTySize =
CGM.getTargetData().getABITypeSizeInBits(ConvertType(Field->getType()));
const llvm::Type *FieldTy = llvm::IntegerType::get(EltTySize);
const llvm::Type *FieldTy = CGM.getTypes().ConvertTypeForMem(Field->getType());
const llvm::PointerType *BaseTy =
cast<llvm::PointerType>(BaseValue->getType());
unsigned AS = BaseTy->getAddressSpace();
@ -578,12 +576,12 @@ LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue,
return LValue::MakeBitfield(V, bitFieldInfo.Begin, bitFieldInfo.Size,
Field->getType()->isSignedIntegerType());
}
V = Builder.CreateStructGEP(BaseValue, idx, "tmp");
// Match union field type.
if (isUnion) {
const llvm::Type * FieldTy = ConvertType(Field->getType());
const llvm::Type *FieldTy = CGM.getTypes().ConvertTypeForMem(Field->getType());
const llvm::PointerType * BaseTy =
cast<llvm::PointerType>(BaseValue->getType());
unsigned AS = BaseTy->getAddressSpace();