Before existing NamedMDNode entry in the symbol table, remove any existing entry with the same name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94600 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2010-01-26 22:03:41 +00:00
parent c618c8aff4
commit 330186e547

View File

@ -194,9 +194,15 @@ public:
/// @name Mutators
/// @{
public:
/// insert - The method inserts a new entry into the stringmap.
/// insert - The method inserts a new entry into the stringmap. This will
/// replace existing entry, if any.
void insert(StringRef Name, NamedMDNode *Node) {
(void) mmap.GetOrCreateValue(Name, Node);
StringMapEntry<NamedMDNode *> &Entry =
mmap.GetOrCreateValue(Name, Node);
if (Entry.getValue() != Node) {
mmap.remove(&Entry);
(void) mmap.GetOrCreateValue(Name, Node);
}
}
/// This method removes a NamedMDNode from the symbol table.