LLDB mainline
MsvcStlAtomic.cpp
Go to the documentation of this file.
1//===-- MsvcStlAtomic.cpp -------------------------------------------------===//
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#include "MsvcStl.h"
10
12
13using namespace lldb;
14
15namespace lldb_private {
16namespace formatters {
17
19public:
21
22 llvm::Expected<uint32_t> CalculateNumChildren() override;
23
24 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
25
27
28 llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override;
29
30private:
33};
34
35} // namespace formatters
36} // namespace lldb_private
37
44
49
52 uint32_t idx) {
53 if (idx == 0)
54 return m_storage->Cast(m_element_type)->Clone(ConstString("Value"));
55 return nullptr;
56}
57
60 m_storage = nullptr;
61 m_element_type.Clear();
62
63 ValueObjectSP storage_sp = m_backend.GetChildMemberWithName("_Storage");
64 if (!storage_sp)
66
67 m_element_type = m_backend.GetCompilerType().GetTypeTemplateArgument(0);
68 if (!m_element_type)
70
71 m_storage = storage_sp.get();
73}
74
75llvm::Expected<size_t> lldb_private::formatters::
77 if (name == "Value")
78 return 0;
79 return llvm::createStringError("Type has no child named '%s'",
80 name.AsCString());
81}
82
88
90 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
91 auto synth_sp = valobj.GetSyntheticValue();
92 if (!synth_sp)
93 return false;
94
95 auto value_sp = synth_sp->GetChildAtIndex(0);
96 std::string summary;
97 if (value_sp->GetSummaryAsCString(summary, options) && !summary.empty()) {
98 stream << summary;
99 return true;
100 }
101 return false;
102}
Generic representation of a type in a programming language.
A uniqued constant string class.
Definition ConstString.h:40
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
A stream class that can stream formatted output to a file.
Definition Stream.h:28
SyntheticChildrenFrontEnd(ValueObject &backend)
lldb::ValueObjectSP GetSyntheticValue()
MsvcStlAtomicSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
llvm::Expected< size_t > GetIndexOfChildWithName(ConstString name) override
llvm::Expected< uint32_t > CalculateNumChildren() override
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
SyntheticChildrenFrontEnd * MsvcStlAtomicSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
bool MsvcStlAtomicSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
A class that represents a running process on the host machine.
ChildCacheState
Specifies if children need to be re-computed after a call to SyntheticChildrenFrontEnd::Update.
@ eRefetch
Children need to be recomputed dynamically.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP