Skip to content

Commit 765058e

Browse files
committed
[lldb] Diagnose a fallback warning for type aliases
(cherry picked from commit 1e36c93)
1 parent eafe7db commit 765058e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3309,6 +3309,11 @@ 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)");
33123317

33133318
// Resolve all generic type parameters in the type for the current
33143319
// 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)