Skip to content

Commit c31b966

Browse files
committed
[test] IRGen: add a test for generating linker directive symbols $ld$hide
1 parent 2537602 commit c31b966

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %target-swift-frontend -swift-version 4 -enforce-exclusivity=checked %s -emit-ir -module-name CurrentModule -D CURRENT_MODULE | %FileCheck %s --check-prefix=CHECK-SAMEMAJOR --check-prefix=CHECK-DIFFMAJOR
2+
3+
@available(OSX 10.8, *)
4+
@_originallyDefinedIn(module: "OriginalModule", macOS 10.10)
5+
public struct Entity {
6+
public func addEntity(_ e: Entity) {}
7+
public func removeEntity(_ e: Entity) {}
8+
}
9+
10+
// CHECK-SAMEMAJOR: $ld$hide$os10.8$_$s14OriginalModule6EntityVN
11+
// CHECK-SAMEMAJOR: $ld$hide$os10.9$_$s14OriginalModule6EntityVN
12+
// CHECK-SAMEMAJOR-NOT: $ld$hide$os10.10$_$s14OriginalModule6EntityVN
13+
14+
@available(OSX 9.8, *)
15+
@_originallyDefinedIn(module: "OriginalModule", macOS 10.10)
16+
public struct OldEntity {
17+
public func addEntity(_ e: Entity) {}
18+
public func removeEntity(_ e: Entity) {}
19+
}
20+
21+
// CHECK-DIFFMAJOR: $ld$hide$os9.9$_$s14OriginalModule9OldEntityVN
22+
// CHECK-DIFFMAJOR: $ld$hide$os9.13$_$s14OriginalModule9OldEntityVN
23+
// CHECK-DIFFMAJOR: $ld$hide$os9.30$_$s14OriginalModule9OldEntityVN
24+
// CHECK-DIFFMAJOR: $ld$hide$os10.8$_$s14OriginalModule9OldEntityVN
25+
// CHECK-DIFFMAJOR: $ld$hide$os10.9$_$s14OriginalModule9OldEntityVN
26+
// CHECK-DIFFMAJOR-NOT: $ld$hide$os10.10$_$s14OriginalModule9OldEntityVN

test/IRGen/original-defined-attr.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@
33

44
#if CURRENT_MODULE
55

6+
@available(OSX 10.8, *)
67
@_originallyDefinedIn(module: "OriginalModule", macOS 10.15)
78
public struct Entity {
89
public func addEntity(_ e: Entity) {}
910
public func removeEntity(_ e: Entity) {}
1011
}
1112

13+
@available(OSX 10.8, *)
1214
@_originallyDefinedIn(module: "OriginalModule", macOS 10.15)
1315
public protocol Movable {
1416
func MovableFuncFoo()
1517
}
1618

1719
public protocol Unmoveable {}
1820

21+
@available(OSX 10.8, *)
1922
@_originallyDefinedIn(module: "OriginalModule", macOS 10.15)
2023
public class MovedClass: Movable, Unmoveable {
2124
public func MovableFuncFoo() {}

0 commit comments

Comments
 (0)