<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>> Hmm, I guess that works - hadn't considered that. Would this
work if the type in the container was PtrLikeInt instead of
PtrLikeInt*? Seems it might be a touch simpler.</p>
<p>I had tried PtrLikeInt but it seems it does not match any trait
in PointerLikeTypeTraits and hence is not considered pointer-like.
Writing a trait specialization for this seemed tedious and an
overkill. Wasn't sure how to implement the getAsVoidPointer. So I
simply used PtrLikeInt*.<br>
</p>
<br>
<div class="moz-cite-prefix">On 9/3/2017 5:20 PM, David Blaikie
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAENS6EtoJ3gmAN6HWugKcji8E_MKWGt0Y7q648JubPMgCyCYKQ@mail.gmail.com">
<div dir="ltr"><br>
<br>
<div class="gmail_quote">
<div dir="ltr">On Sun, Sep 3, 2017 at 12:06 AM Mandeep Singh
Grang via Phabricator <<a
href="mailto:reviews@reviews.llvm.org"
moz-do-not-send="true">reviews@reviews.llvm.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">mgrang
added inline comments.<br>
<br>
<br>
================<br>
Comment at: unittests/Support/ReverseIterationTest.cpp:69<br>
+<br>
+ static unsigned getHashValue(const PtrLikeInt *PtrVal) {<br>
+ return (unsigned)(PtrVal->value * 37U);<br>
----------------<br>
How about this implementation? PtrLikeInt is pointer-like
but it hashes based on an integer value.<br>
</blockquote>
<div><br>
Hmm, I guess that works - hadn't considered that. Would this
work if the type in the container was PtrLikeInt instead of
PtrLikeInt*? Seems it might be a touch simpler.<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
I don't think this would work for SmallPtrSet (as you had
pointed out). </blockquote>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
================<br>
Comment at: unittests/Support/ReverseIterationTest.cpp:95<br>
+ if (shouldReverseIterate<PtrLikeInt *>())<br>
+ std::reverse(&IterKeys[0], &IterKeys[4]);<br>
+<br>
----------------<br>
@dblaikie llvm::reverse(IterKeys) does not change the
existing array, right?.</blockquote>
<div><br>
Oh, right, sure.<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"> I found
using std::reverse cleaner than using another array to hold
the reversed one. What do you say?<br>
</blockquote>
<div><br>
Fine as-is.<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Repository:<br>
rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D37241" rel="noreferrer"
target="_blank" moz-do-not-send="true">https://reviews.llvm.org/D37241</a><br>
<br>
<br>
<br>
</blockquote>
</div>
</div>
</blockquote>
<br>
</body>
</html>