diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-20 23:49:09 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-20 23:49:09 +0000 |
| commit | 789ce142dfbec434cb332247542ea8d437da53ce (patch) | |
| tree | 31ab95d87d26651870f286934935612d12d399d2 /clang/lib/CodeGen/CGExprAgg.cpp | |
| parent | 27c42e66bbe98924cedeaeb8a534b25ba0ce4310 (diff) | |
| download | bcm5719-llvm-789ce142dfbec434cb332247542ea8d437da53ce.tar.gz bcm5719-llvm-789ce142dfbec434cb332247542ea8d437da53ce.zip | |
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
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index c7f65bf4202..0c1e23965df 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<ImplicitValueInitExpr>(E)) { + } else if (isa<ImplicitValueInitExpr>(E) || isa<CXXScalarValueInitExpr>(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()) { |

