1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

IR: Deduplicate getParent() functions on derived classes of GlobalValue into the base class. NFCI.

llvm-svn: 285050
This commit is contained in:
Peter Collingbourne 2016-10-25 02:54:08 +00:00
parent 1f6ecd860a
commit 667b6a8f41
7 changed files with 6 additions and 24 deletions

View File

@ -74,8 +74,6 @@ private:
friend class SymbolTableListTraits<Function>;
void setParent(Module *parent);
/// hasLazyArguments/CheckLazyArguments - The argument list of a function is
/// built on demand, so that the list isn't allocated until the first client
/// needs it. The hasLazyArguments predicate returns true if the arg list

View File

@ -30,8 +30,6 @@ class GlobalAlias : public GlobalIndirectSymbol,
void operator=(const GlobalAlias &) = delete;
GlobalAlias(const GlobalAlias &) = delete;
void setParent(Module *parent);
GlobalAlias(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage,
const Twine &Name, Constant *Aliasee, Module *Parent);

View File

@ -35,8 +35,6 @@ class GlobalIFunc final : public GlobalIndirectSymbol,
void operator=(const GlobalIFunc &) = delete;
GlobalIFunc(const GlobalIFunc &) = delete;
void setParent(Module *parent);
GlobalIFunc(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage,
const Twine &Name, Constant *Resolver, Module *Parent);

View File

@ -140,6 +140,12 @@ protected:
}
Module *Parent; // The containing module.
// Used by SymbolTableListTraits.
void setParent(Module *parent) {
Parent = parent;
}
public:
enum ThreadLocalMode {
NotThreadLocal = 0,

View File

@ -38,8 +38,6 @@ class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
void operator=(const GlobalVariable &) = delete;
GlobalVariable(const GlobalVariable &) = delete;
void setParent(Module *parent);
bool isConstantGlobal : 1; // Is this a global constant?
bool isExternallyInitializedConstant : 1; // Is this a global whose value
// can change from its initial

View File

@ -330,10 +330,6 @@ bool Function::arg_empty() const {
return getFunctionType()->getNumParams() == 0;
}
void Function::setParent(Module *parent) {
Parent = parent;
}
// dropAllReferences() - This function causes all the subinstructions to "let
// go" of all references that they are maintaining. This allows one to
// 'delete' a whole class at a time, even though there may be circular

View File

@ -265,10 +265,6 @@ GlobalVariable::GlobalVariable(Module &M, Type *Ty, bool constant,
M.getGlobalList().push_back(this);
}
void GlobalVariable::setParent(Module *parent) {
Parent = parent;
}
void GlobalVariable::removeFromParent() {
getParent()->getGlobalList().remove(getIterator());
}
@ -367,10 +363,6 @@ GlobalAlias *GlobalAlias::create(const Twine &Name, GlobalValue *Aliasee) {
return create(Aliasee->getLinkage(), Name, Aliasee);
}
void GlobalAlias::setParent(Module *parent) {
Parent = parent;
}
void GlobalAlias::removeFromParent() {
getParent()->getAliasList().remove(getIterator());
}
@ -404,10 +396,6 @@ GlobalIFunc *GlobalIFunc::create(Type *Ty, unsigned AddressSpace,
return new GlobalIFunc(Ty, AddressSpace, Link, Name, Resolver, ParentModule);
}
void GlobalIFunc::setParent(Module *parent) {
Parent = parent;
}
void GlobalIFunc::removeFromParent() {
getParent()->getIFuncList().remove(getIterator());
}