A few corrections to the expr constant work. Not enabled at the

moment.

llvm-svn: 59435
This commit is contained in:
Eli Friedman 2008-11-17 03:57:28 +00:00
parent a5055a03c6
commit dcbcbb827d
1 changed files with 3 additions and 2 deletions

View File

@ -859,7 +859,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
const llvm::Type *Type = const llvm::Type *Type =
llvm::PointerType::getUnqual(llvm::Type::Int8Ty); llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
const llvm::Type *DestType = C->getType(); const llvm::Type *DestType = getTypes().ConvertTypeForMem(E->getType());
// FIXME: It's a little ugly that we need to cast to a pointer, // FIXME: It's a little ugly that we need to cast to a pointer,
// apply the GEP and then cast back. // apply the GEP and then cast back.
@ -872,7 +872,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
return llvm::ConstantExpr::getIntToPtr(Offset, return llvm::ConstantExpr::getIntToPtr(Offset,
getTypes().ConvertType(type)); getTypes().ConvertType(type));
} }
case APValue::Int: case APValue::Int: {
llvm::Constant *C = llvm::ConstantInt::get(V.getInt()); llvm::Constant *C = llvm::ConstantInt::get(V.getInt());
if (C->getType() == llvm::Type::Int1Ty) { if (C->getType() == llvm::Type::Int1Ty) {
@ -880,6 +880,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
C = llvm::ConstantExpr::getZExt(C, BoolTy); C = llvm::ConstantExpr::getZExt(C, BoolTy);
} }
return C; return C;
}
case APValue::Float: case APValue::Float:
return llvm::ConstantFP::get(V.getFloat()); return llvm::ConstantFP::get(V.getFloat());
case APValue::ComplexFloat: { case APValue::ComplexFloat: {