Use ilist_tratis to autoinsert and remove NamedMDNode from MDSymbolTable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93247 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2010-01-12 18:34:06 +00:00
parent 3bda20112e
commit 26028f27dd
5 changed files with 31 additions and 18 deletions

View File

@@ -57,6 +57,7 @@ template<> struct ilist_traits<GlobalAlias>
static GlobalAlias *createSentinel();
static void destroySentinel(GlobalAlias *GA) { delete GA; }
};
template<> struct ilist_traits<NamedMDNode>
: public SymbolTableListTraits<NamedMDNode, Module> {
// createSentinel is used to get hold of a node that marks the end of
@@ -69,6 +70,8 @@ template<> struct ilist_traits<NamedMDNode>
NamedMDNode *provideInitialHead() const { return createSentinel(); }
NamedMDNode *ensureHead(NamedMDNode*) const { return createSentinel(); }
static void noteHead(NamedMDNode*, NamedMDNode*) {}
void addNodeToList(NamedMDNode *N);
void removeNodeFromList(NamedMDNode *N);
private:
mutable ilist_node<NamedMDNode> Sentinel;
};
@@ -324,10 +327,6 @@ public:
/// NamedMDNode with the specified name is not found.
NamedMDNode *getOrInsertNamedMetadata(StringRef Name);
/// addMDNodeName - Insert an entry in the NamedMDNode symbol table mapping
/// Name to NMD.
void addMDNodeName(StringRef Name, NamedMDNode *NMD);
/// @}
/// @name Type Accessors
/// @{