aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode/Reader
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-16 21:25:55 +0000
committerChris Lattner <sabre@nondot.org>2010-03-16 21:25:55 +0000
commit535969b90b24725bd3145ffd638077a5dd5e50fd (patch)
treed694e4a5c050ee2ef44074d5b102c8e4305f6754 /lib/Bitcode/Reader
parentbc6543220fcf2d3e29740db297b4ccf736a21fa7 (diff)
downloadexternal_llvm-535969b90b24725bd3145ffd638077a5dd5e50fd.zip
external_llvm-535969b90b24725bd3145ffd638077a5dd5e50fd.tar.gz
external_llvm-535969b90b24725bd3145ffd638077a5dd5e50fd.tar.bz2
reapply r98656 unmodified, which exposed the asmprinter not
handling constant unions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Reader')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index a328837..b9453c9 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -293,6 +293,8 @@ void BitcodeReaderValueList::ResolveConstantForwardRefs() {
} else if (ConstantStruct *UserCS = dyn_cast<ConstantStruct>(UserC)) {
NewC = ConstantStruct::get(Context, &NewOps[0], NewOps.size(),
UserCS->getType()->isPacked());
+ } else if (ConstantUnion *UserCU = dyn_cast<ConstantUnion>(UserC)) {
+ NewC = ConstantUnion::get(UserCU->getType(), NewOps[0]);
} else if (isa<ConstantVector>(UserC)) {
NewC = ConstantVector::get(&NewOps[0], NewOps.size());
} else {
@@ -1015,6 +1017,11 @@ bool BitcodeReader::ParseConstants() {
Elts.push_back(ValueList.getConstantFwdRef(Record[i],
STy->getElementType(i)));
V = ConstantStruct::get(STy, Elts);
+ } else if (const UnionType *UnTy = dyn_cast<UnionType>(CurTy)) {
+ uint64_t Index = Record[0];
+ Constant *Val = ValueList.getConstantFwdRef(Record[1],
+ UnTy->getElementType(Index));
+ V = ConstantUnion::get(UnTy, Val);
} else if (const ArrayType *ATy = dyn_cast<ArrayType>(CurTy)) {
const Type *EltTy = ATy->getElementType();
for (unsigned i = 0; i != Size; ++i)