From 933f67887fcce41e73655b33da237e6bc61a46ea Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 12 Apr 2010 21:10:05 +0000 Subject: fix PR6660/6168: emit padding as zeros instead of undef. Because trailing fields may not be represented in initializer lists, they are being handled as padding and those fields *must* be zero initialized. llvm-svn: 101067 --- clang/lib/CodeGen/CGExprConstant.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CGExprConstant.cpp') diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 172a77d78e5..c57cf5b7b62 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -231,7 +231,7 @@ class ConstStructBuilder { if (NumBytes > 1) Ty = llvm::ArrayType::get(Ty, NumBytes); - llvm::Constant *C = llvm::UndefValue::get(Ty); + llvm::Constant *C = llvm::Constant::getNullValue(Ty); Elements.push_back(C); assert(getAlignment(C) == 1 && "Padding must have 1 byte alignment!"); @@ -269,7 +269,7 @@ class ConstStructBuilder { if (NumBytes > 1) Ty = llvm::ArrayType::get(Ty, NumBytes); - llvm::Constant *Padding = llvm::UndefValue::get(Ty); + llvm::Constant *Padding = llvm::Constant::getNullValue(Ty); PackedElements.push_back(Padding); ElementOffsetInBytes += getSizeInBytes(Padding); } @@ -509,7 +509,7 @@ public: if (NumPadBytes > 1) Ty = llvm::ArrayType::get(Ty, NumPadBytes); - Elts.push_back(llvm::UndefValue::get(Ty)); + Elts.push_back(llvm::Constant::getNullValue(Ty)); Types.push_back(Ty); } -- cgit v1.2.3