[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 10:05:11 PDT 2017


dblaikie added inline comments.


================
Comment at: include/llvm/ADT/DepthFirstIterator.h:83
+template <typename T, typename NodeRef>
+auto call_completed_method_imp(T &t, NodeRef V, bool) -> decltype(void()) {
+  return;
----------------
I'm guessing this is for consistency? But I'd probably write this with a traditional return type?

  void call_completed_method_imp(...) {


================
Comment at: include/llvm/ADT/DepthFirstIterator.h:88-89
+template <typename T, typename NodeRef>
+auto call_completed_method(T &t, NodeRef V)
+    -> decltype(call_completed_method_imp(t, V, 0), void()) {
+  call_completed_method_imp(t, V, 0);
----------------
What's the delayed return type achieve here - given that there's the fallback overload of call_completed_method_imp, it wouldn't be providing any SFINAE, would it? (& there's not some other overload of call_completed_method that'd be selected)

Should this be:

  void call_completed_method(...) {
    return call_completed_method_imp(t, V, 0);
  }


https://reviews.llvm.org/D38806





More information about the llvm-commits mailing list