1//===-- Coroutines.h --------------------------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_COROUTINES_H
10#define LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_COROUTINES_H
11
12#include "lldb/DataFormatters/TypeSummary.h"
13#include "lldb/DataFormatters/TypeSynthetic.h"
14#include "lldb/Utility/Stream.h"
15#include "lldb/ValueObject/ValueObject.h"
16
17namespace lldb_private {
18
19namespace formatters {
20
21/// Summary provider for `std::coroutine_handle<T>` from libc++, libstdc++ and
22/// MSVC STL.
23bool StdlibCoroutineHandleSummaryProvider(ValueObject &valobj, Stream &stream,
24 const TypeSummaryOptions &options);
25
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`.
30class StdlibCoroutineHandleSyntheticFrontEnd
31 : public SyntheticChildrenFrontEnd {
32public:
33 StdlibCoroutineHandleSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
34
35 ~StdlibCoroutineHandleSyntheticFrontEnd() override;
36
37 llvm::Expected<uint32_t> CalculateNumChildren() override;
38
39 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
40
41 lldb::ChildCacheState Update() override;
42
43 llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override;
44
45private:
46 std::vector<lldb::ValueObjectSP> m_children;
47};
48
49SyntheticChildrenFrontEnd *
50StdlibCoroutineHandleSyntheticFrontEndCreator(CXXSyntheticChildren *,
51 lldb::ValueObjectSP);
52
53} // namespace formatters
54} // namespace lldb_private
55
56#endif // LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_COROUTINES_H
57

source code of lldb/source/Plugins/Language/CPlusPlus/Coroutines.h