summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-05-16 13:34:04 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-05-16 13:34:04 +0000
commit4fe0094fd15c9b94e4940994cced3e23baafdb9b (patch)
tree3a8e76199bad6971294da68811ba0d0edb19678b /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent95442c445fa2b5f5b43100ca049dcc6e3b01c0f8 (diff)
downloadbcm5719-llvm-4fe0094fd15c9b94e4940994cced3e23baafdb9b.tar.gz
bcm5719-llvm-4fe0094fd15c9b94e4940994cced3e23baafdb9b.zip
Change the GlobalAlias constructor to look a bit more like GlobalVariable.
This is part of the fix for pr10367. A GlobalAlias always has a pointer type, so just have the constructor build the type. llvm-svn: 208983
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index d0ce237ee67..a1ae6baff9f 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1966,8 +1966,10 @@ error_code BitcodeReader::ParseModule(bool Resume) {
if (!Ty->isPointerTy())
return Error(InvalidTypeForValue);
- GlobalAlias *NewGA = new GlobalAlias(Ty, GetDecodedLinkage(Record[2]),
- "", nullptr, TheModule);
+ auto *PTy = cast<PointerType>(Ty);
+ GlobalAlias *NewGA =
+ new GlobalAlias(PTy->getElementType(), GetDecodedLinkage(Record[2]),
+ "", nullptr, TheModule, PTy->getAddressSpace());
// Old bitcode files didn't have visibility field.
// Local linkage must have default visibility.
if (Record.size() > 3 && !NewGA->hasLocalLinkage())
OpenPOWER on IntegriCloud