[PATCH] D23522: [ADT] Change PostOrderIterator to use NodeRef. NFC.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 14:24:24 PDT 2016


dblaikie accepted this revision.
This revision is now accepted and ready to land.

================
Comment at: include/llvm/ADT/PostOrderIterator.h:126
@@ -123,3 +125,3 @@
       : po_iterator_storage<SetType, ExtStorage>(S) {
-    if (this->insertEdge((NodeType*)nullptr, BB)) {
+    if (this->insertEdge(Optional<NodeRef>(), BB)) {
       VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
----------------
timshen wrote:
> dblaikie wrote:
> > Optional<T>() => None
> > 
> > (& in a few other places)
> The conversion doesn't work here, because po_iterator_storage has insertEdge as a template function on NodeRef.
> 
> We can move the "template <typename NodeRef>" from insertEdge up to po_iterator_storage, but that involves other po_iterator_storage template changes as well.
Alternatively you could take the first argument to insertEdge as an opaque parameter (another template parameter T) and then convert it in the implementation:

  Optional<NodeRef> From = FromValue;

But that might be too weird/complicated with all the different implementations.


https://reviews.llvm.org/D23522





More information about the llvm-commits mailing list