Skip to content

Commit cee9300

Browse files
Merge pull request #6314 from augusto2112/get-byte-stride-fallback
[lldb] Add fallback to TypeSystemSwiftTypeRef::GetByteStride
2 parents 9a8dda9 + e2b3e9a commit cee9300

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
@@ -2658,8 +2658,15 @@ TypeSystemSwiftTypeRef::GetByteStride(opaque_compiler_type_t type,
26582658
auto impl = [&]() -> llvm::Optional<uint64_t> {
26592659
if (auto *runtime =
26602660
SwiftLanguageRuntime::Get(exe_scope->CalculateProcess())) {
2661-
return runtime->GetByteStride(GetCanonicalType(type));
2661+
if (auto stride = runtime->GetByteStride(GetCanonicalType(type)))
2662+
return stride;
26622663
}
2664+
// Runtime failed, fallback to SwiftASTContext.
2665+
LLDB_LOGF(GetLog(LLDBLog::Types),
2666+
"Couldn't compute stride of type %s using SwiftLanguageRuntime.",
2667+
AsMangledName(type));
2668+
if (auto *swift_ast_context = GetSwiftASTContext())
2669+
return swift_ast_context->GetByteStride(ReconstructType(type), exe_scope);
26632670
return {};
26642671
};
26652672
VALIDATE_AND_RETURN(impl, GetByteStride, type, exe_scope,

0 commit comments

Comments
 (0)