Reduce abuse of default values in the GlobalAlias constructor.

This is in preparation for adding an optional offset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209073 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-05-17 19:57:46 +00:00
parent a2f8219646
commit fbd8cc0926
11 changed files with 52 additions and 28 deletions

View File

@@ -213,9 +213,9 @@ void GlobalVariable::copyAttributesFrom(const GlobalValue *Src) {
// GlobalAlias Implementation
//===----------------------------------------------------------------------===//
GlobalAlias::GlobalAlias(Type *Ty, LinkageTypes Link, const Twine &Name,
GlobalObject *Aliasee, Module *ParentModule,
unsigned AddressSpace)
GlobalAlias::GlobalAlias(Type *Ty, unsigned AddressSpace, LinkageTypes Link,
const Twine &Name, GlobalObject *Aliasee,
Module *ParentModule)
: GlobalValue(PointerType::get(Ty, AddressSpace), Value::GlobalAliasVal,
&Op<0>(), 1, Link, Name) {
LeakDetector::addGarbageObject(this);
@@ -225,6 +225,23 @@ GlobalAlias::GlobalAlias(Type *Ty, LinkageTypes Link, const Twine &Name,
ParentModule->getAliasList().push_back(this);
}
GlobalAlias::GlobalAlias(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage,
const Twine &Name, Module *Parent)
: GlobalAlias(Ty, AddressSpace, Linkage, Name, nullptr, Parent) {}
GlobalAlias::GlobalAlias(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage,
const Twine &Name, GlobalObject *Aliasee)
: GlobalAlias(Ty, AddressSpace, Linkage, Name, Aliasee,
Aliasee->getParent()) {}
GlobalAlias::GlobalAlias(LinkageTypes Link, const Twine &Name,
GlobalObject *Aliasee)
: GlobalAlias(Aliasee->getType()->getElementType(),
Aliasee->getType()->getAddressSpace(), Link, Name, Aliasee) {}
GlobalAlias::GlobalAlias(const Twine &Name, GlobalObject *Aliasee)
: GlobalAlias(Aliasee->getLinkage(), Name, Aliasee) {}
void GlobalAlias::setParent(Module *parent) {
if (getParent())
LeakDetector::addGarbageObject(this);