add a method
authorChris Lattner <sabre@nondot.org>
Mon, 30 Oct 2006 03:14:15 +0000 (03:14 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 30 Oct 2006 03:14:15 +0000 (03:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31288 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/CStringMap.h
include/llvm/ADT/StringMap.h

index d869f66788188caa84237f4c950693078e3d7da2..d1beb42ebc97c2a7edda53bb6aa1eb79b94e625e 100644 (file)
@@ -86,6 +86,14 @@ public:
     return static_cast<ValueTy*>(TheTable[BucketNo].Item);
   }
   
+  /// GetKeyForValueInMap - Given a value that is inserted into this map, return
+  /// the string that corresponds to it.  This is an efficient operation that
+  /// is provided by CStringMap.  The string is live as long as the value is in
+  /// the map.
+  static const char *GetKeyForValueInMap(const ValueTy &Val) {
+    return reinterpret_cast<const char*>(&Val+1);
+  }
+  
   /// GetOrCreateValue - Look up the specified key in the table.  If a value
   /// exists, return it.  Otherwise, default construct a value, insert it, and
   /// return.
index d869f66788188caa84237f4c950693078e3d7da2..d1beb42ebc97c2a7edda53bb6aa1eb79b94e625e 100644 (file)
@@ -86,6 +86,14 @@ public:
     return static_cast<ValueTy*>(TheTable[BucketNo].Item);
   }
   
+  /// GetKeyForValueInMap - Given a value that is inserted into this map, return
+  /// the string that corresponds to it.  This is an efficient operation that
+  /// is provided by CStringMap.  The string is live as long as the value is in
+  /// the map.
+  static const char *GetKeyForValueInMap(const ValueTy &Val) {
+    return reinterpret_cast<const char*>(&Val+1);
+  }
+  
   /// GetOrCreateValue - Look up the specified key in the table.  If a value
   /// exists, return it.  Otherwise, default construct a value, insert it, and
   /// return.