Skip to content

Commit 2327306

Browse files
authored
Merge pull request #4914 from augusto2112/tsstyperef-getbitsize-fallback
[lldb] TSSTypeRef::GetBitSize fallback to SASTContext if runtime fails
2 parents 862cd9f + 5e6723f commit 2327306

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,18 +2520,15 @@ TypeSystemSwiftTypeRef::GetBitSize(opaque_compiler_type_t type,
25202520
SwiftLanguageRuntime::Get(exe_scope->CalculateProcess())) {
25212521
if (auto result = runtime->GetBitSize({this, type}, exe_scope))
25222522
return result;
2523-
// If this is an expression context, perhaps the type was
2524-
// defined in the expression. In that case we don't have debug
2525-
// info for it, so defer to SwiftASTContext.
2526-
if (llvm::isa_and_nonnull<SwiftASTContextForExpressions>(
2527-
GetSwiftASTContext()))
2528-
return ReconstructType({this, type}).GetBitSize(exe_scope);
2523+
// Runtime failed, fallback to SwiftASTContext.
25292524
LLDB_LOGF(GetLog(LLDBLog::Types),
25302525
"Couldn't compute size of type %s using SwiftLanguageRuntime.",
25312526
AsMangledName(type));
2532-
return {};
2527+
if (auto *swift_ast_context = GetSwiftASTContext())
2528+
return swift_ast_context->GetBitSize(ReconstructType(type), exe_scope);
25332529
}
25342530

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

0 commit comments

Comments
 (0)