[Lldb-commits] [PATCH] D132624: [LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`

Adrian Vogelsgesang via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 26 06:57:02 PDT 2022


avogelsgesang added a comment.

> I don't know much about coroutines, but it seems like your goal is to format them like a linked list

Yes, and no. Coroutines are a compiler-provided type-erasure mechanism which (among other things) erase the type of the contained promise.
One common use case is that the library types (`std::generator`, the upcoming `std::lazy`, user-defined types, ...) store a "next"/"continuation" pointer inside that promise.

> so maybe the (synthetic) object which represents the "next" coroutine (promise?) in the list should be of a pointer type, forcing the lldb (and user) to do an actual dereference operation before viewing the next element. Maybe that could be achieved by changing the type of __promise.continuation.promise (I'm using the example from your patch description) from std::...::promise_type to std::...::promise_type * ?

Good idea. That should work!

I will prepare a separate review which uses this approach. I would prefer to still first land this patch, then D132735 <https://reviews.llvm.org/D132735>, because I want to reuse helper functions from those two commits for making the proposed change


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132624



More information about the lldb-commits mailing list