Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
unittests/Support/ReverseIterationTest.cpp | ||
---|---|---|
87–92 | I'm not sure this is going to be more stable than the previous version, right? The pointers may be strictly ordered now, but the hashing container might order them in other ways that could mean different orders depending on higher bits in the pointer values... What I had in mind/was previously suggesting was to use integer keys that are pointer like & so you can control all the bits. This would work for the DenseMap test, presumably, but maybe not the SmallPtrSet test (which might only accept real pointer keys, not pointer-like keys). | |
99 | llvm::reverse(IterKeys); |
unittests/Support/ReverseIterationTest.cpp | ||
---|---|---|
69 | How about this implementation? PtrLikeInt is pointer-like but it hashes based on an integer value. | |
95 | @dblaikie llvm::reverse(IterKeys) does not change the existing array, right?. I found using std::reverse cleaner than using another array to hold the reversed one. What do you say? |
unittests/Support/ReverseIterationTest.cpp | ||
---|---|---|
61–67 | Rather than mangling pointers - have two fixed instances of PtrLikeInt that can be pointed to (a local static PtrLikeInt in getEmpty/TombstoneKey would probably suffice: static PtrLikeInt *getEmptyKey() { static const PtrLikeInt EmptyKey; return &EmptyKey; } something like that? (drop the 'inline' keyword from (static and non-static) member functions defined inline in a class - they already have that linkage) | |
70 | Maybe just make the value /be/ the hash, do you think? Not sure if that makes it any better or worse (it doesn't have to be a good hash function - simplicity might be preferable) Maybe make PtrLikeInt's member 'unsigned' to match the hash value type. |
unittests/Support/ReverseIterationTest.cpp | ||
---|---|---|
61–67 | Making EmptyKey as a "const" would require an initializer as well as a change in the signature of the getEmptyKey function (which causes build conflicts due to mismatching definitions). So I have dropped the const. |
Rather than mangling pointers - have two fixed instances of PtrLikeInt that can be pointed to (a local static PtrLikeInt in getEmpty/TombstoneKey would probably suffice:
something like that? (drop the 'inline' keyword from (static and non-static) member functions defined inline in a class - they already have that linkage)