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/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 820f3ac..0507c5a 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -919,9 +919,10 @@
// If there is no linkage to be performed or we're linking from the source,
// bring over SGA.
- GlobalAlias *NewDA = new GlobalAlias(TypeMap.get(SGA->getType()),
- SGA->getLinkage(), SGA->getName(),
- /*aliasee*/nullptr, DstM);
+ auto *PTy = cast<PointerType>(TypeMap.get(SGA->getType()));
+ GlobalAlias *NewDA =
+ new GlobalAlias(PTy->getElementType(), SGA->getLinkage(), SGA->getName(),
+ /*aliasee*/ nullptr, DstM, PTy->getAddressSpace());
copyGVAttributes(NewDA, SGA);
if (NewVisibility)
NewDA->setVisibility(*NewVisibility);