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/IR/Globals.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/IR/Globals.cpp') diff --git a/lib/IR/Globals.cpp b/lib/IR/Globals.cpp index 0ec54fe3c0..8e7478496f 100644 --- a/lib/IR/Globals.cpp +++ b/lib/IR/Globals.cpp @@ -213,15 +213,17 @@ void GlobalVariable::copyAttributesFrom(const GlobalValue *Src) { // GlobalAlias Implementation //===----------------------------------------------------------------------===// -GlobalAlias::GlobalAlias(Type *Ty, LinkageTypes Link, - const Twine &Name, Constant* aliasee, - Module *ParentModule) - : GlobalValue(Ty, Value::GlobalAliasVal, &Op<0>(), 1, Link, Name) { +GlobalAlias::GlobalAlias(Type *Ty, LinkageTypes Link, const Twine &Name, + Constant *Aliasee, Module *ParentModule, + unsigned AddressSpace) + : GlobalValue(PointerType::get(Ty, AddressSpace), Value::GlobalAliasVal, + &Op<0>(), 1, Link, Name) { LeakDetector::addGarbageObject(this); - if (aliasee) - assert(aliasee->getType() == Ty && "Alias and aliasee types should match!"); - Op<0>() = aliasee; + if (Aliasee) + assert(Aliasee->getType() == getType() && + "Alias and aliasee types should match!"); + Op<0>() = Aliasee; if (ParentModule) ParentModule->getAliasList().push_back(this); -- cgit v1.2.3