فهرست منبع

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285050 91177308-0d34-0410-b5e6-96231b3b80d8
Peter Collingbourne 8 سال پیش
والد
کامیت
6ff6048618

+ 0 - 2
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

+ 0 - 2
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);
 

+ 0 - 2
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);
 

+ 6 - 0
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,

+ 0 - 2
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

+ 0 - 4
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

+ 0 - 12
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());
 }