<div dir="ltr">+Tim who did some GraphTraits refactoring<br><br><div class="gmail_quote"><div dir="ltr">On Tue, May 23, 2017 at 7:56 PM Jared Carlson via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I’m trying to port a project up to 4.0 and I’m seeing the following error:<br>
<br>
In file included from /Users/jaredcarlson/Projects/llvm-4.0.0.src/include/llvm/ADT/StringRef.h:13:<br>
/Users/jaredcarlson/Projects/llvm-4.0.0.src/include/llvm/ADT/STLExtras.h:139:13: error: no type named 'type' in 'std::__1::result_of<std::__1::pointer_to_unary_function<llvm::DSNode *, llvm::DSNode &><br>
(llvm::DSNode &)>'<br>
::type value_type;<br>
~~^~~~<br>
/Users/jaredcarlson/Projects/crab-llvm/dsa-seahorn/include/dsa/DSGraphTraits.h:122:25: note: in instantiation of template class<br>
'llvm::mapped_iterator<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::DSNode, true, false, void>, false, false>, std::__1::pointer_to_unary_function<llvm::DSNode *, llvm::DSNode &> >'<br>
requested here<br>
static nodes_iterator nodes_begin(DSGraph *G) {<br>
<br>
So, it looks to me like in DSGraph, the iterator needs to be dereferenced correctly. Right now the source reads:<br>
<br>
template <> struct GraphTraits<DSGraph*> {<br>
typedef DSNode NodeType;<br>
typedef DSNode::iterator ChildIteratorType;<br>
<br>
// not sure this is necessary anymore as NodeRef must be a pointer<br>
typedef std::pointer_to_unary_function<DSNode *, DSNode&> DerefFun;<br>
<br>
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph<br>
typedef mapped_iterator<DSGraph::node_iterator, DerefFun> nodes_iterator;<br>
<br>
static nodes_iterator nodes_begin(DSGraph *G) {<br>
return map_iterator( G->node_begin(), DerefFun(dereference) );<br>
}<br>
static nodes_iterator nodes_end(DSGraph *G) {<br>
return map_iterator( G->node_end(), DerefFun(dereference) );<br>
}<br>
<br>
static ChildIteratorType child_begin(NodeType *N) { return N->begin(); }<br>
static ChildIteratorType child_end(NodeType *N) { return N->end(); }<br>
};<br>
<br>
I”m just unsure as in 4.0, there’s a need for a NodeRef to leverage the GraphTraits template which needs to be.a pointer but I don’t think that’s all that relevant here and the above code looks consistent with what I’m used to…<br>
<br>
DSGraph::iterator by the way is ilist<DSNode>::iterator, as the graph allows walking the nodes….<br>
<br>
Any hints, would be much appreciated…. Thanks!<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>