Skip to content

Commit 1931ef1

Browse files
committed
Add test/embedded/linkage-mergeable-dead-strip.swift test
1 parent d25f1fa commit 1931ef1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %empty-directory(%t)
2+
3+
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -enable-experimental-feature SymbolLinkageMarkers -module-name main -mergeable-symbols -O %s -emit-ir | %FileCheck %s --check-prefix=CHECK-IR
4+
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -enable-experimental-feature SymbolLinkageMarkers -module-name main -mergeable-symbols -O %s -c -o %t/a.o
5+
// RUN: %target-clang %t/a.o -o %t/a.out -dead_strip
6+
// RUN: %llvm-nm --defined-only --format=just-symbols --demangle %t/a.out | sort | %FileCheck %s --check-prefix=CHECK-NM
7+
// RUN: %target-run %t/a.out | %FileCheck %s
8+
9+
// REQUIRES: swift_in_compiler
10+
// REQUIRES: executable_test
11+
// REQUIRES: OS=macosx
12+
// REQUIRES: swift_feature_Embedded
13+
14+
public func a_this_is_unused() { }
15+
16+
@_used
17+
public func b_this_is_unused_but_explicitly_retained() { }
18+
19+
// CHECK-IR: define weak_odr {{.*}}@"$e4main16a_this_is_unusedyyF"()
20+
// CHECK-IR: define weak_odr {{.*}}@"$e4main40b_this_is_unused_but_explicitly_retainedyyF"()
21+
22+
// CHECK-NM-NOT: $e4main14this_is_unusedyyF
23+
// CHECK-NM: $e4main40b_this_is_unused_but_explicitly_retainedyyF
24+
25+
print("Hello")
26+
// CHECK: Hello

0 commit comments

Comments
 (0)