summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/ImmutableMap.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-01-17 17:36:49 +0000
committerTed Kremenek <kremenek@apple.com>2008-01-17 17:36:49 +0000
commite509e7a17819f808dabb815474eb8c04540de7b3 (patch)
tree99034954f3ae96d48108cc4ade2ae21bcb7076c8 /include/llvm/ADT/ImmutableMap.h
parent39354cb743c5a1473de7a80b957c61e92cf76852 (diff)
downloadllvm-e509e7a17819f808dabb815474eb8c04540de7b3.tar.gz
llvm-e509e7a17819f808dabb815474eb8c04540de7b3.tar.bz2
llvm-e509e7a17819f808dabb815474eb8c04540de7b3.tar.xz
Implemented "FIXME" in ImutAVLTree: isEqual() now also compares the *data* value
and not just the key value when comparing trees. To do this we added data_type and data_type_ref to the ImutContainerInfo trait classes. For values stored in the tree that do not have separate key and data components, data_type is simply a typedef of bool, and isDataEqual() always evaluates to true. This allows us to support both ImmutableSet and ImmutableMap using the same underlying logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46130 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/ImmutableMap.h')
-rw-r--r--include/llvm/ADT/ImmutableMap.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/llvm/ADT/ImmutableMap.h b/include/llvm/ADT/ImmutableMap.h
index 9646929c3c..273a297738 100644
--- a/include/llvm/ADT/ImmutableMap.h
+++ b/include/llvm/ADT/ImmutableMap.h
@@ -34,14 +34,21 @@ struct ImutKeyValueInfo {
return V.first;
}
- static inline bool isEqual(key_type_ref L, key_type_ref R) {
- return ImutContainerInfo<T>::isEqual(L,R);
+ static inline data_type_ref DataOfValue(value_type_ref V) {
+ return V.second;
}
+ static inline bool isEqual(key_type_ref L, key_type_ref R) {
+ return ImutContainerInfo<T>::isEqual(L,R);
+ }
static inline bool isLess(key_type_ref L, key_type_ref R) {
return ImutContainerInfo<T>::isLess(L,R);
}
+ static inline bool isDataEqual(data_type_ref L, data_type_ref R) {
+ return ImutContainerInfo<S>::isEqual(L,R);
+ }
+
static inline void Profile(FoldingSetNodeID& ID, value_type_ref V) {
ImutContainerInfo<T>::Profile(ID, V.first);
ImutContainerInfo<S>::Profile(ID, V.second);