Michael137 added a comment.

In D138558#3963732 <https://reviews.llvm.org/D138558#3963732>, @labath wrote:

> You may want to check that this kind of automatic dereferencing does not send 
> lldb into a tailspin if the printed data structure is recursive. I know we 
> had problems like that with smart pointer pretty printers.
>
> I'd try some code like:
>
>   #include <ranges>
>   #include <vector>
>   
>   struct A {
>     std::ranges::ref_view<std::vector<A>> a;
>   };
>   
>   int main() {
>       std::vector<A> v;
>       v.push_back(A{v});
>       v[0].a = v;
>       // print v ?
>   }

@labath good point

E.g., the following would cause such unbounded recursion (didn't find a good 
way of triggering it using the actual ref_view since it's not default 
constructible, but it's probably doable):

  #include <vector>
  
  namespace std {
  inline namespace __1 {
  namespace ranges {
  template<typename T>
  struct ref_view {
      T* __range_;
  };
  }
  }
  }
  
  struct Foo {
      std::ranges::ref_view<std::vector<Foo>> a;
  };
  
  int main() {
      Foo f;
      std::vector<Foo> v;
      v.push_back(f);
  
      std::ranges::ref_view<std::vector<Foo>> r{.__range_ = &v};
      f.a = r;
  
      return 0;
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138558/new/

https://reviews.llvm.org/D138558

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

Reply via email to