Skip to content

Commit 26c73f3

Browse files
authored
Merge pull request #7801 from augusto2112/next-e2b3e9a6f4b453071232c3cf91ec10bcb53d7f2a
[lldb] Add fallback to TypeSystemSwiftTypeRef::GetByteStride
2 parents 8b2a58f + 03584dc commit 26c73f3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2666,8 +2666,15 @@ TypeSystemSwiftTypeRef::GetByteStride(opaque_compiler_type_t type,
26662666
auto impl = [&]() -> llvm::Optional<uint64_t> {
26672667
if (auto *runtime =
26682668
SwiftLanguageRuntime::Get(exe_scope->CalculateProcess())) {
2669-
return runtime->GetByteStride(GetCanonicalType(type));
2669+
if (auto stride = runtime->GetByteStride(GetCanonicalType(type)))
2670+
return stride;
26702671
}
2672+
// Runtime failed, fallback to SwiftASTContext.
2673+
LLDB_LOGF(GetLog(LLDBLog::Types),
2674+
"Couldn't compute stride of type %s using SwiftLanguageRuntime.",
2675+
AsMangledName(type));
2676+
if (auto *swift_ast_context = GetSwiftASTContext())
2677+
return swift_ast_context->GetByteStride(ReconstructType(type), exe_scope);
26712678
return {};
26722679
};
26732680
VALIDATE_AND_RETURN(impl, GetByteStride, type, exe_scope,

0 commit comments

Comments
 (0)