File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -1360,10 +1360,19 @@ OriginallyDefinedInAttr::isActivePlatform(const ASTContext &ctx) const {
1360
1360
Result.Platform = Platform;
1361
1361
Result.Version = MovedVersion;
1362
1362
Result.ModuleName = OriginalModuleName;
1363
- if (isPlatformActive (Platform, ctx.LangOpts )) {
1363
+ if (isPlatformActive (Platform, ctx.LangOpts , /* TargetVariant */ false )) {
1364
1364
Result.IsSimulator = ctx.LangOpts .Target .isSimulatorEnvironment ();
1365
1365
return Result;
1366
1366
}
1367
+
1368
+ // Also check if the platform is active by using target variant. This ensures
1369
+ // we emit linker directives for multiple platforms when building zippered
1370
+ // libraries.
1371
+ if (ctx.LangOpts .TargetVariant .hasValue () &&
1372
+ isPlatformActive (Platform, ctx.LangOpts , /* TargetVariant*/ true )) {
1373
+ Result.IsSimulator = ctx.LangOpts .TargetVariant ->isSimulatorEnvironment ();
1374
+ return Result;
1375
+ }
1367
1376
return None;
1368
1377
}
1369
1378
Original file line number Diff line number Diff line change 7
7
// RUN: %target-swift-frontend -typecheck %S/Inputs/linker-directive.swift -emit-tbd -emit-tbd-path %t/linker_directives.tbd -previous-module-installname-map-file %S/Inputs/install-name-map-toasterkit.json
8
8
// RUN: %FileCheck %s < %t/linker_directives.tbd
9
9
10
+ // RUN: %target-swift-frontend -target-variant x86_64-apple-ios13.0-macabi -typecheck %S/Inputs/linker-directive.swift -emit-tbd -emit-tbd-path %t/linker_directives.tbd -previous-module-installname-map-file %S/Inputs/install-name-map-toasterkit.json
11
+ // RUN: %FileCheck -check-prefix=CHECK-ZIPPERED %s < %t/linker_directives.tbd
12
+
10
13
// CHECK: $ld$previous$/System/Previous/macOS/ToasterKit.dylib$$1$10.8$10.15$_$s10ToasterKit5toastyyF$
11
14
// CHECK: $ld$previous$/System/Previous/macOS/ToasterKit.dylib$$1$10.8$10.15$_$s10ToasterKit7VehicleV4moveyyF$
12
15
// CHECK: $ld$previous$/System/Previous/macOS/ToasterKit.dylib$$1$10.8$10.15$_$s10ToasterKit7VehicleVMa$
13
16
// CHECK: $ld$previous$/System/Previous/macOS/ToasterKit.dylib$$1$10.8$10.15$_$s10ToasterKit7VehicleVMn$
14
- // CHECK: $ld$previous$/System/Previous/macOS/ToasterKit.dylib$$1$10.8$10.15$_$s10ToasterKit7VehicleVN$
17
+ // CHECK: $ld$previous$/System/Previous/macOS/ToasterKit.dylib$$1$10.8$10.15$_$s10ToasterKit7VehicleVN$
18
+
19
+ // CHECK-ZIPPERED: $ld$previous$/System/Previous/iOS/ToasterKit.dylib$$2$10.2$13.0$_$s10ToasterKit5toastyyF$
20
+ // CHECK-ZIPPERED: $ld$previous$/System/Previous/macOS/ToasterKit.dylib$$1$10.8$10.15$_$s10ToasterKit5toastyyF$
You can’t perform that action at this time.
0 commit comments