summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-10-25 02:54:08 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-10-25 02:54:08 +0000
commitca7664e761c68f9b77b39ad589bdc8c58ad61e0f (patch)
tree6edfa13036240b8b9a25626bdea104cbf2a5eb59 /llvm
parent3364f907836d50482f77c7def3952b09e99caa97 (diff)
downloadbcm5719-llvm-ca7664e761c68f9b77b39ad589bdc8c58ad61e0f.tar.gz
bcm5719-llvm-ca7664e761c68f9b77b39ad589bdc8c58ad61e0f.zip
IR: Deduplicate getParent() functions on derived classes of GlobalValue into the base class. NFCI.
llvm-svn: 285050
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/IR/Function.h2
-rw-r--r--llvm/include/llvm/IR/GlobalAlias.h2
-rw-r--r--llvm/include/llvm/IR/GlobalIFunc.h2
-rw-r--r--llvm/include/llvm/IR/GlobalValue.h6
-rw-r--r--llvm/include/llvm/IR/GlobalVariable.h2
-rw-r--r--llvm/lib/IR/Function.cpp4
-rw-r--r--llvm/lib/IR/Globals.cpp12
7 files changed, 6 insertions, 24 deletions
diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h
index 57b328c39c7..e6e26c89f2f 100644
--- a/llvm/include/llvm/IR/Function.h
+++ b/llvm/include/llvm/IR/Function.h
@@ -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
diff --git a/llvm/include/llvm/IR/GlobalAlias.h b/llvm/include/llvm/IR/GlobalAlias.h
index 3ae3e4a001e..3727c10faa7 100644
--- a/llvm/include/llvm/IR/GlobalAlias.h
+++ b/llvm/include/llvm/IR/GlobalAlias.h
@@ -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);
diff --git a/llvm/include/llvm/IR/GlobalIFunc.h b/llvm/include/llvm/IR/GlobalIFunc.h
index 0cbe882c58d..afe6b3d2c35 100644
--- a/llvm/include/llvm/IR/GlobalIFunc.h
+++ b/llvm/include/llvm/IR/GlobalIFunc.h
@@ -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);
diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h
index bd7cacc3248..2b7bb783d30 100644
--- a/llvm/include/llvm/IR/GlobalValue.h
+++ b/llvm/include/llvm/IR/GlobalValue.h
@@ -140,6 +140,12 @@ protected:
}
Module *Parent; // The containing module.
+
+ // Used by SymbolTableListTraits.
+ void setParent(Module *parent) {
+ Parent = parent;
+ }
+
public:
enum ThreadLocalMode {
NotThreadLocal = 0,
diff --git a/llvm/include/llvm/IR/GlobalVariable.h b/llvm/include/llvm/IR/GlobalVariable.h
index d49660b9d31..3787f030e08 100644
--- a/llvm/include/llvm/IR/GlobalVariable.h
+++ b/llvm/include/llvm/IR/GlobalVariable.h
@@ -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
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index e1b4d4af457..d5ecd92524d 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -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
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index 1e4f0b4935f..58fc25a1d18 100644
--- a/llvm/lib/IR/Globals.cpp
+++ b/llvm/lib/IR/Globals.cpp
@@ -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());
}
OpenPOWER on IntegriCloud