Skip to content

Commit cd779d2

Browse files
Merge pull request #1963 from adrian-prantl/66928153
Make sure the Swift REPL is initialized with host OS availablity
2 parents 812fd46 + 4e85bc4 commit cd779d2

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lldb/source/Target/TargetList.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ Status TargetList::CreateTargetInternal(
254254
// If we have a valid architecture, make sure the current platform is
255255
// compatible with that architecture.
256256
if (!prefer_platform_arch && arch.IsValid()) {
257-
if (!platform_sp->IsCompatibleArchitecture(arch, false, nullptr)) {
257+
ArchSpec compatible_arch;
258+
if (!platform_sp->IsCompatibleArchitecture(arch, false, &compatible_arch)) {
258259
platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
259260
if (!is_dummy_target && platform_sp)
260261
debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// -*- mode: swift; -*-
2+
// Test that the REPL is launched with the current OS as availability target.
3+
// REQUIRES: system-darwin
4+
5+
// RUN: mkdir -p %t.dir
6+
// RUN: echo '@available(macOS '>%t.dir/NewModule.swift
7+
// RUN: sw_vers | grep ProductVersion | cut -d : -f 2 >>%t.dir/NewModule.swift
8+
// RUN: echo ', *) public let message = "Hello"' >>%t.dir/NewModule.swift
9+
// RUN: %target-swiftc -module-name NewModule -emit-module -emit-library -o %t.dir/libNewModule%target-shared-library-suffix %t.dir/NewModule.swift
10+
11+
// RUN: %lldb --repl="-I%t.dir -L%t.dir -lNewModule" --repl-language swift < %s | FileCheck %s
12+
import NewModule
13+
message
14+
// CHECK: $R0{{.*}}Hello

0 commit comments

Comments
 (0)