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

llvm-svn: 94600
This commit is contained in:
Devang Patel 2010-01-26 22:03:41 +00:00
parent 833ef45b1d
commit 670ca2bcbf
1 changed files with 8 additions and 2 deletions

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.