Skip to content

Commit ea5181f

Browse files
authored
Merge pull request #6125 from augusto2112/1013-lldb-info-prov-exe-scope
[lldb] Pass exec context/scope to functions in LLDBTypeInfoProvider
2 parents fb1d1f8 + c55cb66 commit ea5181f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,13 +643,17 @@ class LLDBTypeInfoProvider : public swift::remote::TypeInfoProvider {
643643
if (auto ti = m_runtime.lookupClangTypeInfo(clang_type))
644644
return *ti;
645645

646+
auto &process = m_runtime.GetProcess();
647+
ExecutionContext exe_ctx;
648+
process.CalculateExecutionContext(exe_ctx);
649+
auto *exe_scope = exe_ctx.GetBestExecutionContextScope();
646650
// Build a TypeInfo for the Clang type.
647-
auto size = clang_type.GetByteSize(nullptr);
648-
auto bit_align = clang_type.GetTypeBitAlign(nullptr);
651+
auto size = clang_type.GetByteSize(exe_scope);
652+
auto bit_align = clang_type.GetTypeBitAlign(exe_scope);
649653
std::vector<swift::reflection::FieldInfo> fields;
650654
if (clang_type.IsAggregateType()) {
651655
// Recursively collect TypeInfo records for all fields.
652-
for (uint32_t i = 0, e = clang_type.GetNumFields(); i != e; ++i) {
656+
for (uint32_t i = 0, e = clang_type.GetNumFields(&exe_ctx); i != e; ++i) {
653657
std::string name;
654658
uint64_t bit_offset_ptr = 0;
655659
uint32_t bitfield_bit_size_ptr = 0;
@@ -2418,6 +2422,11 @@ void SwiftLanguageRuntimeImpl::DumpTyperef(
24182422
s->PutCString(string_stream.str());
24192423
}
24202424

2425+
2426+
Process &SwiftLanguageRuntimeImpl::GetProcess() const {
2427+
return m_process;
2428+
}
2429+
24212430
// Dynamic type resolution tends to want to generate scalar data - but there are
24222431
// caveats
24232432
// Per original comment here

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeImpl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ class SwiftLanguageRuntimeImpl {
192192
std::function<const swift::reflection::TypeRef *()> get_typeref;
193193
};
194194

195+
Process &GetProcess() const;
196+
195197
/// An abstract interface to swift::reflection::ReflectionContext
196198
/// objects of varying pointer sizes. This class encapsulates all
197199
/// traffic to ReflectionContext and abstracts the detail that

0 commit comments

Comments
 (0)