[llvm-commits] [llvm] r46229 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h
Ted Kremenek
kremenek at apple.com
Mon Jan 21 14:54:46 PST 2008
Author: kremenek
Date: Mon Jan 21 16:54:46 2008
New Revision: 46229
URL: http://llvm.org/viewvc/llvm-project?rev=46229&view=rev
Log:
Fixed buggy caching of the hash value of an ImutAVLTree node.
Modified:
llvm/trunk/include/llvm/ADT/ImmutableSet.h
Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=46229&r1=46228&r2=46229&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Mon Jan 21 16:54:46 2008
@@ -231,9 +231,12 @@
}
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
More information about the llvm-commits
mailing list