1 //===-- Coroutines.h --------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_COROUTINES_H
10 #define LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_COROUTINES_H
12 #include "lldb/DataFormatters/TypeSummary.h"
13 #include "lldb/DataFormatters/TypeSynthetic.h"
14 #include "lldb/Utility/Stream.h"
15 #include "lldb/ValueObject/ValueObject.h"
17 namespace lldb_private
{
19 namespace formatters
{
21 /// Summary provider for `std::coroutine_handle<T>` from libc++, libstdc++ and
23 bool StdlibCoroutineHandleSummaryProvider(ValueObject
&valobj
, Stream
&stream
,
24 const TypeSummaryOptions
&options
);
26 /// Synthetic children frontend for `std::coroutine_handle<promise_type>` from
27 /// libc++, libstdc++ and MSVC STL. Shows the compiler-generated `resume` and
28 /// `destroy` function pointers as well as the `promise`, if the promise type
29 /// is `promise_type != void`.
30 class StdlibCoroutineHandleSyntheticFrontEnd
31 : public SyntheticChildrenFrontEnd
{
33 StdlibCoroutineHandleSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp
);
35 ~StdlibCoroutineHandleSyntheticFrontEnd() override
;
37 llvm::Expected
<uint32_t> CalculateNumChildren() override
;
39 lldb::ValueObjectSP
GetChildAtIndex(uint32_t idx
) override
;
41 lldb::ChildCacheState
Update() override
;
43 bool MightHaveChildren() override
;
45 size_t GetIndexOfChildWithName(ConstString name
) override
;
48 lldb::ValueObjectSP m_resume_ptr_sp
;
49 lldb::ValueObjectSP m_destroy_ptr_sp
;
50 lldb::ValueObjectSP m_promise_ptr_sp
;
53 SyntheticChildrenFrontEnd
*
54 StdlibCoroutineHandleSyntheticFrontEndCreator(CXXSyntheticChildren
*,
57 } // namespace formatters
58 } // namespace lldb_private
60 #endif // LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_COROUTINES_H