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
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index d0b3800..e5813f0 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -673,8 +673,10 @@
return Error(AliaseeLoc, "alias must have pointer type");
// Okay, create the alias but do not insert it into the module yet.
- std::unique_ptr<GlobalAlias> GA(new GlobalAlias(
- Aliasee->getType(), (GlobalValue::LinkageTypes)Linkage, Name, Aliasee));
+ PointerType *PTy = cast<PointerType>(Aliasee->getType());
+ std::unique_ptr<GlobalAlias> GA(
+ new GlobalAlias(PTy->getElementType(), (GlobalValue::LinkageTypes)Linkage,
+ Name, Aliasee, nullptr, PTy->getAddressSpace()));
GA->setVisibility((GlobalValue::VisibilityTypes)Visibility);
GA->setDLLStorageClass((GlobalValue::DLLStorageClassTypes)DLLStorageClass);