@@ -336,7 +336,7 @@ static llvm::Error AddVariableInfo(
336336 should_not_bind_generic_types &&
337337 (variable_sp->GetType ()->GetForwardCompilerType ().GetTypeInfo () &
338338 lldb::eTypeIsPack);
339-
339+ bool is_meaningless_without_dynamic_resolution = false ;
340340 // If we're not binding the generic types, we need to set the self type as an
341341 // opaque pointer type. This is necessary because we don't bind the generic
342342 // parameters, and we can't have a type with unbound generics in a non-generic
@@ -349,8 +349,13 @@ static llvm::Error AddVariableInfo(
349349 CompilerType var_type = SwiftExpressionParser::ResolveVariable (
350350 variable_sp, stack_frame_sp, runtime, use_dynamic, bind_generic_types);
351351
352- Status error;
353- target_type = ast_context.ImportType (var_type, error);
352+ is_meaningless_without_dynamic_resolution =
353+ var_type.IsMeaninglessWithoutDynamicResolution ();
354+
355+ // ImportType would only return a TypeRef type anyway, so it's
356+ // faster to leave the type in its original context for faster
357+ // type alias resolution.
358+ target_type = var_type;
354359 }
355360
356361 // If the import failed, give up.
@@ -376,8 +381,7 @@ static llvm::Error AddVariableInfo(
376381 // If we couldn't fully realize the type, then we aren't going
377382 // to get very far making a local out of it, so discard it here.
378383 Log *log = GetLog (LLDBLog::Types | LLDBLog::Expressions);
379- if (!is_unbound_pack && ts->IsMeaninglessWithoutDynamicResolution (
380- target_type.GetOpaqueQualType ())) {
384+ if (is_meaningless_without_dynamic_resolution) {
381385 if (log)
382386 log->Printf (" Discarding local %s because we couldn't fully realize it, "
383387 " our best attempt was: %s." ,
0 commit comments