From d24ec75bdc02aea9e52de0b2bc5583c75ebe9a55 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 12 Nov 2025 13:35:31 -0500 Subject: [PATCH] [Swift] Update for frontend API changes --- .../ExpressionParser/Swift/SwiftASTManipulator.cpp | 8 +++----- .../ExpressionParser/Swift/SwiftExpressionParser.cpp | 2 +- .../ExpressionParser/Swift/SwiftSILManipulator.cpp | 3 +-- .../Swift/SwiftLanguageRuntimeRemoteAST.cpp | 2 +- lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lldb/source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.cpp b/lldb/source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.cpp index 622bf74585e1e..30556c0603396 100644 --- a/lldb/source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.cpp +++ b/lldb/source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.cpp @@ -530,8 +530,7 @@ void SwiftASTManipulator::FindVariableDeclarations( size_t persistent_info_location = m_variables.size(); - auto type = var_decl->getDeclContext()->mapTypeIntoContext( - var_decl->getInterfaceType()); + auto type = var_decl->getTypeInContext(); m_variables.emplace_back(ToCompilerType({type.getPointer()}), name, var_decl); found_declarations.push_back(persistent_info_location); @@ -859,8 +858,7 @@ GetPatternBindingForVarDecl(swift::VarDecl *var_decl, } } } - swift::Type type = containing_context->mapTypeIntoContext( - var_decl->getInterfaceType()); + swift::Type type = var_decl->getTypeInContext(); swift::TypedPattern *typed_pattern = swift::TypedPattern::createImplicit(ast_context, named_pattern, type); @@ -947,7 +945,7 @@ llvm::Expected SwiftASTManipulator::GetSwiftTypeForVariable( } if (swift_type->hasArchetype()) - swift_type = swift_type->mapTypeOutOfContext(); + swift_type = swift_type->mapTypeOutOfEnvironment(); return {swift_type}; } diff --git a/lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp index 28bec5a1050b2..cd42b0a3da8fd 100644 --- a/lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp @@ -992,7 +992,7 @@ MaterializeVariable(SwiftASTManipulatorBase::VariableInfo &variable, "transformed type is empty"); actual_type = - ToCompilerType(transformed_type->mapTypeOutOfContext().getPointer()); + ToCompilerType(transformed_type->mapTypeOutOfEnvironment().getPointer()); auto swift_ast_ctx = actual_type.GetTypeSystem().dyn_cast_or_null(); if (!swift_ast_ctx) diff --git a/lldb/source/Plugins/ExpressionParser/Swift/SwiftSILManipulator.cpp b/lldb/source/Plugins/ExpressionParser/Swift/SwiftSILManipulator.cpp index a5ed9416cb484..7aa9db1666ab8 100644 --- a/lldb/source/Plugins/ExpressionParser/Swift/SwiftSILManipulator.cpp +++ b/lldb/source/Plugins/ExpressionParser/Swift/SwiftSILManipulator.cpp @@ -103,8 +103,7 @@ swift::SILValue SwiftSILManipulator::emitLValueForVariable( swift::LoadInst *pointer_to_variable = m_builder.createLoad(null_loc, pointer_to_return_slot, swift::LoadOwnershipQualifier::Trivial); - auto type = var->getDeclContext()->mapTypeIntoContext( - var->getInterfaceType()); + auto type = var->getTypeInContext(); auto loweredType = converter.getLoweredRValueType( swift::TypeExpansionContext::minimal(), type); diff --git a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeRemoteAST.cpp b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeRemoteAST.cpp index 9a52c5d7968e2..b5d7b1897caa0 100644 --- a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeRemoteAST.cpp +++ b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeRemoteAST.cpp @@ -300,7 +300,7 @@ SwiftLanguageRuntime::BindGenericTypeParametersRemoteAST( llvm::expectedToStdOptional(swift_ast_ctx->GetSwiftType(base_type)) .value_or(swift::Type())); if (target_swift_type->hasArchetype()) - target_swift_type = target_swift_type->mapTypeOutOfContext().getPointer(); + target_swift_type = target_swift_type->mapTypeOutOfEnvironment().getPointer(); ThreadSafeASTContext ast_ctx = swift_ast_ctx->GetASTContext(); if (!ast_ctx) diff --git a/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp b/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp index 74bbd0c9ec58c..51d00bdfacb72 100644 --- a/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp +++ b/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp @@ -8390,7 +8390,7 @@ CompilerType SwiftASTContext::GetUnboundGenericType(opaque_compiler_type_t type, llvm::ArrayRef params = generic_sig.getGenericParams(); swift::Type paramTy = params[idx]; - return ToCompilerType({nominal_type_decl->mapTypeIntoContext(paramTy) + return ToCompilerType({nominal_type_decl->mapTypeIntoEnvironment(paramTy) ->castTo()}); }