Skip to content

Commit 95f423b

Browse files
Merge pull request #10549 from adrian-prantl/cherry-pick-next-lldb-Diagnose-a-fallback-warning-for-type-aliases
[Cherry-pick into next] [lldb] Diagnose a fallback warning for type aliases
2 parents eafe7db + b5713e5 commit 95f423b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3309,6 +3309,12 @@ SwiftLanguageRuntime::GetSwiftRuntimeTypeInfo(
33093309

33103310
// Resolve all type aliases.
33113311
type = type.GetCanonicalType();
3312+
if (!type) {
3313+
// FIXME: We could print a better error message if
3314+
// GetCanonicalType() returned an Expected.
3315+
return llvm::createStringError(
3316+
"could not get canonical type (possibly due to unresolved typealias)");
3317+
}
33123318

33133319
// Resolve all generic type parameters in the type for the current
33143320
// frame. Generic parameter binding has to happen in the scratch

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3420,7 +3420,11 @@ TypeSystemSwiftTypeRef::GetCanonicalType(opaque_compiler_type_t type) {
34203420
// then we don't have debug info to resolve it from.
34213421
CompilerType ast_type =
34223422
ReconstructType({weak_from_this(), type}, nullptr).GetCanonicalType();
3423-
return GetTypeFromMangledTypename(ast_type.GetMangledTypeName());
3423+
CompilerType result =
3424+
GetTypeFromMangledTypename(ast_type.GetMangledTypeName());
3425+
if (result && !llvm::isa<TypeSystemSwiftTypeRefForExpressions>(this))
3426+
DiagnoseSwiftASTContextFallback(__FUNCTION__, type);
3427+
return result;
34243428
}
34253429
auto flavor = SwiftLanguageRuntime::GetManglingFlavor(AsMangledName(type));
34263430
auto mangling = mangleNode(canonical, flavor);

0 commit comments

Comments
 (0)