[llvm-commits] [llvm] r94600 - /llvm/trunk/include/llvm/ValueSymbolTable.h
Devang Patel
dpatel at apple.com
Tue Jan 26 14:03:42 PST 2010
Author: dpatel
Date: Tue Jan 26 16:03:41 2010
New Revision: 94600
URL: http://llvm.org/viewvc/llvm-project?rev=94600&view=rev
Log:
Before existing NamedMDNode entry in the symbol table, remove any existing entry with the same name.
Modified:
llvm/trunk/include/llvm/ValueSymbolTable.h
Modified: llvm/trunk/include/llvm/ValueSymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ValueSymbolTable.h?rev=94600&r1=94599&r2=94600&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ValueSymbolTable.h (original)
+++ llvm/trunk/include/llvm/ValueSymbolTable.h Tue Jan 26 16:03:41 2010
@@ -194,9 +194,15 @@
/// @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.
More information about the llvm-commits
mailing list