| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 1 | //===-- LibCxx.h ---------------------------------------------------*- C++ |
| 2 | //-*-===// |
| Enrico Granata | 419d791 | 2015-09-04 00:33:51 +0000 | [diff] [blame] | 3 | // |
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| Enrico Granata | 419d791 | 2015-09-04 00:33:51 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef liblldb_LibCxx_h_ |
| 11 | #define liblldb_LibCxx_h_ |
| 12 | |
| Enrico Granata | 419d791 | 2015-09-04 00:33:51 +0000 | [diff] [blame] | 13 | #include "lldb/Core/ValueObject.h" |
| 14 | #include "lldb/DataFormatters/TypeSummary.h" |
| 15 | #include "lldb/DataFormatters/TypeSynthetic.h" |
| Zachary Turner | bf9a773 | 2017-02-02 21:39:50 +0000 | [diff] [blame] | 16 | #include "lldb/Utility/Stream.h" |
| Enrico Granata | 419d791 | 2015-09-04 00:33:51 +0000 | [diff] [blame] | 17 | |
| 18 | namespace lldb_private { |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 19 | namespace formatters { |
| Enrico Granata | 419d791 | 2015-09-04 00:33:51 +0000 | [diff] [blame] | 20 | |
| Shafik Yaghmour | 693fbf5 | 2018-10-26 17:00:48 +0000 | [diff] [blame] | 21 | bool LibcxxStringSummaryProviderASCII( |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 22 | ValueObject &valobj, Stream &stream, |
| Shafik Yaghmour | 693fbf5 | 2018-10-26 17:00:48 +0000 | [diff] [blame] | 23 | const TypeSummaryOptions &summary_options); // libc++ std::string |
| 24 | |
| 25 | bool LibcxxStringSummaryProviderUTF16( |
| 26 | ValueObject &valobj, Stream &stream, |
| 27 | const TypeSummaryOptions &summary_options); // libc++ std::u16string |
| 28 | |
| 29 | bool LibcxxStringSummaryProviderUTF32( |
| 30 | ValueObject &valobj, Stream &stream, |
| 31 | const TypeSummaryOptions &summary_options); // libc++ std::u32string |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 32 | |
| 33 | bool LibcxxWStringSummaryProvider( |
| 34 | ValueObject &valobj, Stream &stream, |
| 35 | const TypeSummaryOptions &options); // libc++ std::wstring |
| 36 | |
| Adrian Prantl | c53d368 | 2018-08-15 22:48:48 +0000 | [diff] [blame] | 37 | bool LibcxxOptionalSummaryProvider( |
| 38 | ValueObject &valobj, Stream &stream, |
| 39 | const TypeSummaryOptions &options); // libc++ std::optional<> |
| 40 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 41 | bool LibcxxSmartPointerSummaryProvider( |
| 42 | ValueObject &valobj, Stream &stream, |
| 43 | const TypeSummaryOptions |
| 44 | &options); // libc++ std::shared_ptr<> and std::weak_ptr<> |
| 45 | |
| Adrian Prantl | 6b58fa7 | 2018-08-23 17:02:39 +0000 | [diff] [blame] | 46 | bool LibcxxFunctionSummaryProvider( |
| 47 | ValueObject &valobj, Stream &stream, |
| 48 | const TypeSummaryOptions &options); // libc++ std::function<> |
| 49 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 50 | SyntheticChildrenFrontEnd * |
| 51 | LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 52 | lldb::ValueObjectSP); |
| 53 | |
| 54 | bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream, |
| 55 | const TypeSummaryOptions &options); |
| 56 | |
| 57 | class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd { |
| 58 | public: |
| 59 | LibCxxMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); |
| 60 | |
| 61 | size_t CalculateNumChildren() override; |
| 62 | |
| 63 | lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; |
| 64 | |
| 65 | bool Update() override; |
| 66 | |
| 67 | bool MightHaveChildren() override; |
| 68 | |
| Adrian Prantl | 0e4c482 | 2019-03-06 21:22:25 +0000 | [diff] [blame] | 69 | size_t GetIndexOfChildWithName(ConstString name) override; |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 70 | |
| 71 | ~LibCxxMapIteratorSyntheticFrontEnd() override; |
| 72 | |
| 73 | private: |
| 74 | ValueObject *m_pair_ptr; |
| Enrico Granata | ae1ba73 | 2016-09-28 22:53:16 +0000 | [diff] [blame] | 75 | lldb::ValueObjectSP m_pair_sp; |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | SyntheticChildrenFrontEnd * |
| 79 | LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 80 | lldb::ValueObjectSP); |
| 81 | |
| 82 | SyntheticChildrenFrontEnd * |
| 83 | LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 84 | lldb::ValueObjectSP); |
| 85 | |
| 86 | class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd { |
| 87 | public: |
| 88 | LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); |
| 89 | |
| 90 | size_t CalculateNumChildren() override; |
| 91 | |
| 92 | lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; |
| 93 | |
| 94 | bool Update() override; |
| 95 | |
| 96 | bool MightHaveChildren() override; |
| 97 | |
| Adrian Prantl | 0e4c482 | 2019-03-06 21:22:25 +0000 | [diff] [blame] | 98 | size_t GetIndexOfChildWithName(ConstString name) override; |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 99 | |
| 100 | ~LibcxxSharedPtrSyntheticFrontEnd() override; |
| 101 | |
| 102 | private: |
| 103 | ValueObject *m_cntrl; |
| 104 | lldb::ValueObjectSP m_count_sp; |
| 105 | lldb::ValueObjectSP m_weak_count_sp; |
| 106 | uint8_t m_ptr_size; |
| 107 | lldb::ByteOrder m_byte_order; |
| 108 | }; |
| 109 | |
| 110 | SyntheticChildrenFrontEnd * |
| Pavel Labath | 5269875 | 2017-11-14 11:15:03 +0000 | [diff] [blame] | 111 | LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 112 | lldb::ValueObjectSP); |
| 113 | |
| 114 | SyntheticChildrenFrontEnd * |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 115 | LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 116 | lldb::ValueObjectSP); |
| 117 | |
| 118 | SyntheticChildrenFrontEnd * |
| 119 | LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 120 | lldb::ValueObjectSP); |
| 121 | |
| 122 | SyntheticChildrenFrontEnd * |
| 123 | LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 124 | lldb::ValueObjectSP); |
| 125 | |
| 126 | SyntheticChildrenFrontEnd * |
| Pavel Labath | 89ac0c7 | 2017-10-31 12:27:43 +0000 | [diff] [blame] | 127 | LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 128 | lldb::ValueObjectSP); |
| 129 | |
| 130 | SyntheticChildrenFrontEnd * |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 131 | LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 132 | lldb::ValueObjectSP); |
| 133 | |
| 134 | SyntheticChildrenFrontEnd * |
| 135 | LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 136 | lldb::ValueObjectSP); |
| 137 | |
| 138 | SyntheticChildrenFrontEnd * |
| 139 | LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 140 | lldb::ValueObjectSP); |
| 141 | |
| Pavel Labath | e0d5184 | 2017-11-01 15:52:08 +0000 | [diff] [blame] | 142 | SyntheticChildrenFrontEnd *LibcxxQueueFrontEndCreator(CXXSyntheticChildren *, |
| 143 | lldb::ValueObjectSP); |
| 144 | |
| Pavel Labath | 333739d | 2017-11-01 15:19:52 +0000 | [diff] [blame] | 145 | SyntheticChildrenFrontEnd *LibcxxTupleFrontEndCreator(CXXSyntheticChildren *, |
| 146 | lldb::ValueObjectSP); |
| 147 | |
| Adrian Prantl | c53d368 | 2018-08-15 22:48:48 +0000 | [diff] [blame] | 148 | SyntheticChildrenFrontEnd * |
| 149 | LibcxxOptionalFrontEndCreator(CXXSyntheticChildren *, |
| 150 | lldb::ValueObjectSP valobj_sp); |
| 151 | |
| Shafik Yaghmour | 8306f76 | 2018-09-19 18:07:05 +0000 | [diff] [blame] | 152 | SyntheticChildrenFrontEnd * |
| 153 | LibcxxVariantFrontEndCreator(CXXSyntheticChildren *, |
| 154 | lldb::ValueObjectSP valobj_sp); |
| 155 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 156 | } // namespace formatters |
| Enrico Granata | 419d791 | 2015-09-04 00:33:51 +0000 | [diff] [blame] | 157 | } // namespace lldb_private |
| 158 | |
| 159 | #endif // liblldb_LibCxx_h_ |