aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--lib/CodeGen/CGExprAgg.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index df90ee09f5..e51a852451 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -340,10 +340,8 @@ void AggExprEmitter::EmitInitializationToLValue(Expr* E, LValue LV) {
void AggExprEmitter::EmitNullInitializationToLValue(LValue LV, QualType T) {
if (!CGF.hasAggregateLLVMType(T)) {
// For non-aggregates, we can store zero
- const llvm::Type *T =
- cast<llvm::PointerType>(LV.getAddress()->getType())->getElementType();
- // FIXME: volatility
- Builder.CreateStore(llvm::Constant::getNullValue(T), LV.getAddress());
+ llvm::Value *Null = llvm::Constant::getNullValue(CGF.ConvertType(T));
+ CGF.EmitStoreThroughLValue(RValue::get(Null), LV, T);
} else {
// Otherwise, just memset the whole thing to zero. This is legal
// because in LLVM, all default initializers are guaranteed to have a