[llvm-commits] CVS: llvm/include/llvm/ADT/CStringMap.h
Chris Lattner
sabre at nondot.org
Sun Oct 29 19:14:29 PST 2006
Changes in directory llvm/include/llvm/ADT:
CStringMap.h updated: 1.2 -> 1.3
---
Log message:
add a method
---
Diffs of the changes: (+8 -0)
CStringMap.h | 8 ++++++++
1 files changed, 8 insertions(+)
Index: llvm/include/llvm/ADT/CStringMap.h
diff -u llvm/include/llvm/ADT/CStringMap.h:1.2 llvm/include/llvm/ADT/CStringMap.h:1.3
--- llvm/include/llvm/ADT/CStringMap.h:1.2 Sun Oct 29 17:47:01 2006
+++ llvm/include/llvm/ADT/CStringMap.h Sun Oct 29 21:14:15 2006
@@ -86,6 +86,14 @@
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.
More information about the llvm-commits
mailing list