[llvm-commits] [llvm] r94600 - /llvm/trunk/include/llvm/ValueSymbolTable.h

Chris Lattner clattner at apple.com
Tue Jan 26 18:15:44 PST 2010


On Jan 26, 2010, at 2:03 PM, Devang Patel wrote:

> 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.

Ok, but why doesn't this use the existing ValueSymbolTable class?  Why  
are NamedMDNodes different than functions?  I know you don't want to  
use "the same" ValueSymbolTable instance that functions live in to  
hold the NamedMDNode, but it seems that Module can have *two*  
ValueSymbolTable's, no?

-Chris

>
> 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.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list