Skip to content

Commit 4105a44

Browse files
authored
Merge pull request #7804 from augusto2112/adapt-swift-ast-call-byte-stride
[lldb] Change GetSwiftASTContext call to take exe_scope in GetByteStride
2 parents e2a279f + d6c7937 commit 4105a44

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2846,8 +2846,16 @@ TypeSystemSwiftTypeRef::GetByteStride(opaque_compiler_type_t type,
28462846
auto impl = [&]() -> llvm::Optional<uint64_t> {
28472847
if (auto *runtime =
28482848
SwiftLanguageRuntime::Get(exe_scope->CalculateProcess())) {
2849-
return runtime->GetByteStride(GetCanonicalType(type));
2849+
if (auto stride = runtime->GetByteStride(GetCanonicalType(type)))
2850+
return stride;
28502851
}
2852+
// Runtime failed, fallback to SwiftASTContext.
2853+
LLDB_LOGF(GetLog(LLDBLog::Types),
2854+
"Couldn't compute stride of type %s using SwiftLanguageRuntime.",
2855+
AsMangledName(type));
2856+
if (auto *swift_ast_context =
2857+
GetSwiftASTContextFromExecutionScope(exe_scope))
2858+
return swift_ast_context->GetByteStride(ReconstructType(type), exe_scope);
28512859
return {};
28522860
};
28532861
VALIDATE_AND_RETURN(impl, GetByteStride, type, exe_scope,

0 commit comments

Comments
 (0)