<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks Tim,<div class=""><br class=""></div><div class="">That’s the direction I was trying to go, but it felt as if I were making things worse so I backed out.  I think I might have been missing the llvm::pointer_iterator and the llvm::pointee_iterator as means to remedy some of this.  I’ll give it a shot and see where I end up, thanks!</div><div class=""><br class=""></div><div class="">Jared</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 24, 2017, at 8:17 PM, Tim Shen <<a href="mailto:timshen@google.com" class="">timshen@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, May 23, 2017 at 7:56 PM Jared Carlson via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Hello,<br class=""><br class="">I’m trying to port a project up to 4.0 and I’m seeing the following error:<br class=""><br class="">In file included from /Users/jaredcarlson/Projects/llvm-4.0.0.src/include/llvm/ADT/StringRef.h:13:<br class="">/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 class="">     <span class="Apple-converted-space"> </span>(llvm::DSNode &)>'<br class="">         <span class="Apple-converted-space"> </span>::type value_type;<br class="">         <span class="Apple-converted-space"> </span>~~^~~~<br class="">/Users/jaredcarlson/Projects/crab-llvm/dsa-seahorn/include/dsa/DSGraphTraits.h:122:25: note: in instantiation of template class<br class="">     <span class="Apple-converted-space"> </span>'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 class="">     <span class="Apple-converted-space"> </span>requested here<br class=""> <span class="Apple-converted-space"> </span>static nodes_iterator nodes_begin(DSGraph *G) {<br class=""><br class="">So, it looks to me like in DSGraph, the iterator needs to be dereferenced correctly.  Right now the source reads:<br class=""><br class=""> template <> struct GraphTraits<DSGraph*> {<br class=""> <span class="Apple-converted-space"> </span>typedef DSNode NodeType;<br class=""> <span class="Apple-converted-space"> </span>typedef DSNode::iterator ChildIteratorType;<br class=""><br class=""> <span class="Apple-converted-space"> </span>// not sure this is necessary anymore as NodeRef must be a pointer<br class=""> <span class="Apple-converted-space"> </span>typedef std::pointer_to_unary_function<DSNode *, DSNode&> DerefFun;<br class=""><br class=""> <span class="Apple-converted-space"> </span>// nodes_iterator/begin/end - Allow iteration over all nodes in the graph<br class=""> <span class="Apple-converted-space"> </span>typedef mapped_iterator<DSGraph::node_iterator, DerefFun> nodes_iterator;<br class=""><br class=""> <span class="Apple-converted-space"> </span>static nodes_iterator nodes_begin(DSGraph *G) {<br class="">   <span class="Apple-converted-space"> </span>return map_iterator( G->node_begin(), DerefFun(dereference) );<br class=""> <span class="Apple-converted-space"> </span>}<br class=""> <span class="Apple-converted-space"> </span>static nodes_iterator nodes_end(DSGraph *G) {<br class="">   <span class="Apple-converted-space"> </span>return map_iterator( G->node_end(), DerefFun(dereference) );<br class=""> <span class="Apple-converted-space"> </span>}<br class=""><br class=""> <span class="Apple-converted-space"> </span>static ChildIteratorType child_begin(NodeType *N) { return N->begin(); }<br class=""> <span class="Apple-converted-space"> </span>static ChildIteratorType child_end(NodeType *N) { return N->end(); }<br class="">};<br class=""><br class="">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 class=""></blockquote><div class=""><br class=""></div><div class="">Please refer to include/llvm/ADT/GraphTraits.h for the documentation.</div><div class=""><br class=""></div><div class="">In your case, for nodes, simply change `typedef DSNode NodeType;` to `typedef DSNode* NodeRef;`</div><div class=""><br class=""></div><div class="">I'm not sure what DSGraph::iterator returns on dereference; but ultimately you want both ChildIteratorType and nodes_iterator to dereference to a NodeRef, as documented. You may find llvm::pointer_iterator or llvm::pointee_iterator helpful.</div><div class=""><br class=""></div><div class="">I'd try to remove DerefFun and the usage of mapped_iterator.</div><div class=""> <br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><br class="">DSGraph::iterator by the way is ilist<DSNode>::iterator, as the graph allows walking the nodes….<br class=""><br class="">Any hints, would be much appreciated…. Thanks!<br class=""><br class=""><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></blockquote></div></div></div></blockquote></div><br class=""></div></body></html>