aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-12 20:49:41 +0000
committerChris Lattner <sabre@nondot.org>2010-02-12 20:49:41 +0000
commitd5d5172c3c572f2f6ce33254511747c58398bf14 (patch)
treef6ba4446fc9db081e5e3386c57d2db253774c1fa /lib/Bitcode/Reader/BitcodeReader.cpp
parent1d7e5c88a3651508ee05a96448668c2b488a5091 (diff)
downloadexternal_llvm-d5d5172c3c572f2f6ce33254511747c58398bf14.zip
external_llvm-d5d5172c3c572f2f6ce33254511747c58398bf14.tar.gz
external_llvm-d5d5172c3c572f2f6ce33254511747c58398bf14.tar.bz2
Add support for a union type in LLVM IR. Patch by Talin!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp')
-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 4dfc6ce..a0402ca 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -585,6 +585,13 @@ bool BitcodeReader::ParseTypeTable() {
ResultTy = StructType::get(Context, EltTys, Record[0]);
break;
}
+ case bitc::TYPE_CODE_UNION: { // UNION: [eltty x N]
+ SmallVector<const Type*, 8> EltTys;
+ for (unsigned i = 0, e = Record.size(); i != e; ++i)
+ EltTys.push_back(getTypeByID(Record[i], true));
+ ResultTy = UnionType::get(&EltTys[0], EltTys.size());
+ break;
+ }
case bitc::TYPE_CODE_ARRAY: // ARRAY: [numelts, eltty]
if (Record.size() < 2)
return Error("Invalid ARRAY type record");