Skip to content

Commit 473ab20

Browse files
author
git apple-llvm automerger
committed
Merge commit '092327f32947' from swift/release/6.0 into stable/20230725
2 parents beb75c6 + 092327f commit 473ab20

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,20 @@ SwiftASTContext::SwiftASTContext(std::string description,
995995
GetClangModulesCacheProperty());
996996
}
997997

998+
static std::string DerivePlatformPluginPath(StringRef sdk_path) {
999+
llvm::StringRef path = sdk_path;
1000+
path = llvm::sys::path::parent_path(path);
1001+
if (llvm::sys::path::filename(path) != "SDKs")
1002+
return {};
1003+
path = llvm::sys::path::parent_path(path);
1004+
if (llvm::sys::path::filename(path) != "Developer")
1005+
return {};
1006+
path = llvm::sys::path::parent_path(path);
1007+
if (!path.ends_with(".platform"))
1008+
return {};
1009+
return std::string(path) + "/usr/local/lib/swift/host/plugins";
1010+
}
1011+
9981012
void SwiftASTContext::SetCompilerInvocationLLDBOverrides() {
9991013
swift::IRGenOptions &ir_gen_opts =
10001014
m_compiler_invocation_ap->getIRGenOptions();
@@ -1018,6 +1032,20 @@ void SwiftASTContext::SetCompilerInvocationLLDBOverrides() {
10181032
// Bypass deserialization safety to allow deserializing internal details from
10191033
// swiftmodule files.
10201034
lang_opts.EnableDeserializationSafety = false;
1035+
1036+
// Platform plugin path (macOS hosts only).
1037+
swift::PluginSearchOption::ExternalPluginPath platform_plugins;
1038+
platform_plugins.SearchPath =
1039+
DerivePlatformPluginPath(m_compiler_invocation_ap->getSDKPath());
1040+
if (!platform_plugins.SearchPath.empty()) {
1041+
platform_plugins.ServerPath = GetPluginServer(platform_plugins.SearchPath);
1042+
if (!platform_plugins.ServerPath.empty()) {
1043+
if (FileSystem::Instance().Exists(platform_plugins.SearchPath) &&
1044+
FileSystem::Instance().Exists(platform_plugins.ServerPath))
1045+
m_compiler_invocation_ap->getSearchPathOptions()
1046+
.PluginSearchOpts.push_back(platform_plugins);
1047+
}
1048+
}
10211049
}
10221050

10231051
SwiftASTContext::~SwiftASTContext() {
@@ -1272,7 +1300,6 @@ static bool DeserializeAllCompilerFlags(swift::CompilerInvocation &invocation,
12721300
for (; !buf.empty(); buf = buf.substr(info.bytes)) {
12731301
llvm::SmallVector<swift::serialization::SearchPath> searchPaths;
12741302
swift::serialization::ExtendedValidationInfo extended_validation_info;
1275-
auto &langOpts = invocation.getLangOptions();
12761303
info = swift::serialization::validateSerializedAST(
12771304
buf, invocation.getSILOptions().EnableOSSAModules,
12781305
/*requiredSDK*/ StringRef(), &extended_validation_info,

lldb/test/API/lang/swift/macro/TestSwiftMacro.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,6 @@ def testInteractive(self):
7171
# CHECK: CacheUserImports(){{.*}}: Macro.
7272
# CHECK: SwiftASTContextForExpressions{{.*}}::LoadOneModule(){{.*}}Imported module Macro from {kind = Serialized Swift AST, filename = "{{.*}}Macro.swiftmodule";}
7373
# CHECK: CacheUserImports(){{.*}}Scanning for search paths in{{.*}}Macro.swiftmodule
74+
# The bots have too old an Xcode for this.
75+
# DISABLED: SwiftASTContextForExpressions{{.*}}::LogConfiguration(){{.*}} -external-plugin-path {{.*}}/Developer/Platforms/{{.*}}.platform/Developer/usr/local/lib/swift/host/plugins{{.*}}#{{.*}}/swift-plugin-server
7476
# CHECK: SwiftASTContextForExpressions{{.*}}::LogConfiguration(){{.*}} -external-plugin-path {{.*}}/lang/swift/macro/{{.*}}#{{.*}}/swift-plugin-server

0 commit comments

Comments
 (0)