<div dir="ltr">Hello everyone,<br><br>I would like to implement a query to check if a node in the CallGraph dominates another CallGraph node. I thus started specializing DomTreeNodeBase and DominatorTreeBase such as I can have CallGraphDomTreeNode and CallGraphDominatorTree.<br><br>After allocating the tree, I call DomTreeNode<CallGraphNode>::recalculate(CallGraph &). However, I cannot instantiate the template as it does seem the part of that function dealing with initializing the post-dominator roots:<br><br>00692       // Initialize the roots list<br>00693       for (typename TraitsTy::nodes_iterator I = TraitsTy::nodes_begin(&F),<br>00694                                         E = TraitsTy::nodes_end(&F); I != E; ++I) {<br>00695         if (TraitsTy::child_begin(I) == TraitsTy::child_end(I))<br>00696           addRoot(I);<br>00697<br>00698         // Prepopulate maps so that we don't get iterator invalidation issues later.<br>00699         this->IDoms[I] = nullptr;<br>00700         this->DomTreeNodes[I] = nullptr;<br>00701       }<br><div><br></div><div>implicitly assumes that it should be possible to convert a TraitsTy::nodes_iterator into a NodeT *.</div><div><br></div><div>In my case, TraitsTy is GraphTraits<CallGraph *> and NodeT is CallGraphNode. I was able to understand that this works fine for the DominatorTree class, as the corresponding TraitsTy::nodes_iterator is a iplist<BasicBlock>::iterator, which provides a type-cast operator to BasicBlock *. I was also able to understand the error I got, since the same operator is missing for GraphTraits<CallGraph *>::nodes_iterator.</div><div><br></div><div>My question is whether the ability of casting a GraphTraits<Ty>::nodes_iterator into a NodeT * is a mandatory requirement for using DominatorTreeBase.</div><div><br></div><div>Thanks,</div><div>Ettore Speziale</div></div>