diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-01-21 22:54:46 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-01-21 22:54:46 +0000 |
commit | 3387060470e25e6917adcdde3baa41e959172e90 (patch) | |
tree | 9be6af40d9b83e9e689507fd6d58b80b3c8c4dc2 /include/llvm/ADT/ImmutableSet.h | |
parent | 8893b0d3ac7b6eb6957e645c59f63651891cef97 (diff) | |
download | external_llvm-3387060470e25e6917adcdde3baa41e959172e90.zip external_llvm-3387060470e25e6917adcdde3baa41e959172e90.tar.gz external_llvm-3387060470e25e6917adcdde3baa41e959172e90.tar.bz2 |
Fixed buggy caching of the hash value of an ImutAVLTree node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/ImmutableSet.h')
-rw-r--r-- | include/llvm/ADT/ImmutableSet.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/llvm/ADT/ImmutableSet.h b/include/llvm/ADT/ImmutableSet.h index 1172460..9f08b03 100644 --- a/include/llvm/ADT/ImmutableSet.h +++ b/include/llvm/ADT/ImmutableSet.h @@ -231,9 +231,12 @@ private: } inline unsigned ComputeHash() { - if (!isMutable() && Hash) return Hash; - Hash = ComputeHash(getSafeLeft(), getRight(), getValue()); - return Hash; + if (Hash) return Hash; + + unsigned X = ComputeHash(getSafeLeft(), getRight(), getValue()); + if (!isMutable()) Hash = X; + + return X; } /// Profile - Generates a FoldingSet profile for a tree node before it is |