From 789ce142dfbec434cb332247542ea8d437da53ce Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 20 Dec 2012 23:49:09 +0000 Subject: Fix some bugs where we would sometimes use 0, not -1, when emitting a null constant of type pointer-to-data-member. llvm-svn: 170806 --- clang/lib/CodeGen/CGExprAgg.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CGExprAgg.cpp') diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index c7f65bf42024..0c1e23965df2 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -931,7 +931,7 @@ AggExprEmitter::EmitInitializationToLValue(Expr* E, LValue LV) { // FIXME: Are initializers affected by volatile? if (Dest.isZeroed() && isSimpleZero(E, CGF)) { // Storing "i32 0" to a zero'd memory location is a noop. - } else if (isa(E)) { + } else if (isa(E) || isa(E)) { EmitNullInitializationToLValue(LV); } else if (type->isReferenceType()) { RValue RV = CGF.EmitReferenceBindingToExpr(E, /*InitializedDecl=*/0); @@ -960,8 +960,8 @@ void AggExprEmitter::EmitNullInitializationToLValue(LValue lv) { return; if (!CGF.hasAggregateLLVMType(type)) { - // For non-aggregates, we can store zero. - llvm::Value *null = llvm::Constant::getNullValue(CGF.ConvertType(type)); + // For non-aggregates, we can store the appropriate null constant. + llvm::Value *null = CGF.CGM.EmitNullConstant(type); // Note that the following is not equivalent to // EmitStoreThroughBitfieldLValue for ARC types. if (lv.isBitField()) { -- cgit v1.2.3