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

Consider renaming and/or generalizing the handlers.

Also, in a follow-up or preliminary commit, could you remove all the DerefFun 
stuff. Move the definition of CGdereference (if they remain) above the typedef 
of nodes_iterator and use decltype(&CGdereference), and you can drop the 
"DerefFun(...)" around the CGdereference). That way the change only needs to 
change the deref function and everything else falls out.

(you could also change the calls to map_iterator to just directly call 
nodes_iterator(...) since you have the specific type, there's no need to call 
the deduction-powered generic function)

(idle rambling: This is why I really want the ability to decltype stateless 
lambdas:

  typedef mapped_iterator<..., decltype([](PairTy P) { return P.second; })> 
nodes_iterator

)


================
Comment at: include/clang/Analysis/CallGraph.h:219
@@ -217,5 +218,3 @@
   }
-  static clang::CallGraphNode &CGdereference(PairTy P) {
-    return *(P.second);
-  }
+  static clang::CallGraphNode *CGdereference(PairTy P) { return P.second; }
 
----------------
I don't have enough context - but presumably this name should be changed now 
that the function doesn't actually dereference? (perhaps this is just get<1, 
PairTy::first_type, PairTy::second_type> - but could be useful to have a 
generic utility, something like 'firster' and 'seconder' - I thought there 
might already be, but couldn't find one. Could generalize it like get<> but 
just allow the actual tuple/pair type to be passed, rather than having to 
decompose it)


https://reviews.llvm.org/D23705



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to