From ab67b30df6b14e8e90f4778215ed4e1d5939638e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 16 May 2014 13:34:04 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208983 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Linker/LinkModules.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/Linker') diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 820f3acace..0507c5acc9 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -919,9 +919,10 @@ bool ModuleLinker::linkAliasProto(GlobalAlias *SGA) { // 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(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); -- cgit v1.2.3