aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-29 17:36:02 +0000
committerChris Lattner <sabre@nondot.org>2010-03-29 17:36:02 +0000
commitd7ba0f2ade9374adbfa7ce62de5d4982e6e10d9c (patch)
treed3f4c55571ca1cdf3021b5fc05f93ea27f47881e /lib/VMCore
parent553881bddcdeb66c0ae06bf9f62ca63b9f29b2e8 (diff)
downloadexternal_llvm-d7ba0f2ade9374adbfa7ce62de5d4982e6e10d9c.zip
external_llvm-d7ba0f2ade9374adbfa7ce62de5d4982e6e10d9c.tar.gz
external_llvm-d7ba0f2ade9374adbfa7ce62de5d4982e6e10d9c.tar.bz2
add support for zero initialized unions, patch by Tim Northover!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Constants.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index c9c9857..bd08880 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -59,6 +59,7 @@ Constant *Constant::getNullValue(const Type *Ty) {
case Type::PointerTyID:
return ConstantPointerNull::get(cast<PointerType>(Ty));
case Type::StructTyID:
+ case Type::UnionTyID:
case Type::ArrayTyID:
case Type::VectorTyID:
return ConstantAggregateZero::get(Ty);
@@ -944,7 +945,8 @@ bool ConstantFP::isValueValidForType(const Type *Ty, const APFloat& Val) {
// Factory Function Implementation
ConstantAggregateZero* ConstantAggregateZero::get(const Type* Ty) {
- assert((Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy()) &&
+ assert((Ty->isStructTy() || Ty->isUnionTy()
+ || Ty->isArrayTy() || Ty->isVectorTy()) &&
"Cannot create an aggregate zero of non-aggregate type!");
LLVMContextImpl *pImpl = Ty->getContext().pImpl;