Skip to content

[lldb] TSSTypeRef::GetBitSize fallback to SASTContext if runtime fails #4914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2520,18 +2520,15 @@ TypeSystemSwiftTypeRef::GetBitSize(opaque_compiler_type_t type,
SwiftLanguageRuntime::Get(exe_scope->CalculateProcess())) {
if (auto result = runtime->GetBitSize({this, type}, exe_scope))
return result;
// If this is an expression context, perhaps the type was
// defined in the expression. In that case we don't have debug
// info for it, so defer to SwiftASTContext.
if (llvm::isa_and_nonnull<SwiftASTContextForExpressions>(
GetSwiftASTContext()))
return ReconstructType({this, type}).GetBitSize(exe_scope);
// Runtime failed, fallback to SwiftASTContext.
LLDB_LOGF(GetLog(LLDBLog::Types),
"Couldn't compute size of type %s using SwiftLanguageRuntime.",
AsMangledName(type));
return {};
if (auto *swift_ast_context = GetSwiftASTContext())
return swift_ast_context->GetBitSize(ReconstructType(type), exe_scope);
}


// FIXME: Move this to the top. Currently this causes VALIDATE
// errors on resilient types, and Foundation overlay types. These
// are most likely bugs in the Swift compiler that need to be
Expand Down