Skip to content

Commit 1e36c93

Browse files
committed
[lldb] Diagnose a fallback warning for type aliases
1 parent bc3f984 commit 1e36c93

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

+5
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

+5-1
Original file line numberDiff line numberDiff line change
@@ -3383,7 +3383,11 @@ TypeSystemSwiftTypeRef::GetCanonicalType(opaque_compiler_type_t type) {
33833383
// then we don't have debug info to resolve it from.
33843384
CompilerType ast_type =
33853385
ReconstructType({weak_from_this(), type}, nullptr).GetCanonicalType();
3386-
return GetTypeFromMangledTypename(ast_type.GetMangledTypeName());
3386+
CompilerType result =
3387+
GetTypeFromMangledTypename(ast_type.GetMangledTypeName());
3388+
if (result && !llvm::isa<TypeSystemSwiftTypeRefForExpressions>(this))
3389+
DiagnoseSwiftASTContextFallback(__FUNCTION__, type);
3390+
return result;
33873391
}
33883392
auto flavor = SwiftLanguageRuntime::GetManglingFlavor(AsMangledName(type));
33893393
auto mangling = mangleNode(canonical, flavor);

0 commit comments

Comments
 (0)