[PATCH] D38806: DepthFirstIterator.h: Use C++11 features to call a completed method onthe set type, instead of requiring that one exists.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 11:27:42 PDT 2017


dblaikie added a comment.

Any chance of a unit test for this?

But as for the general design - yeah, this looks about like what I'd expect to see to achieve this. Hadn't seen the overload preference trick (int/bool) - and nice to see more decltype based SFINAE rather than all the trait goo we'd have had to have written in the past.



================
Comment at: include/llvm/ADT/DepthFirstIterator.h:80
+    -> decltype(t.completed(V), void()) {
+  return t.completed(V);
+}
----------------
the 'return' here might be a bit misleading/confusing - since the return type of call_completed_method_imp is void, this statement is only valid if 'completed' returns void as well. Probably drop/remove the 'return' here.


https://reviews.llvm.org/D38806





More information about the llvm-commits mailing list