blob: fd260566bcacc147fc0d7dc2d5b370e54d985913 [file] [log] [blame]
// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck -check-prefix CHECK -check-prefix NEGATIVE -check-prefix CHECK-%target-object-format %s
// REQUIRES: CPU=x86_64
sil_stage canonical
sil private @foo : $@convention(thin) () -> () {
bb0:
%0 = function_ref @bar : $@convention(thin) () -> ()
%1 = apply %0() : $@convention(thin) () -> ()
return %1 : $()
}
sil public_external @bar : $@convention(thin) () -> () {
bb0:
%1 = tuple ()
return %1 : $()
}
sil shared @baz : $@convention(thin) () -> () {
bb0:
%0 = function_ref @bar : $@convention(thin) () -> ()
%1 = apply %0() : $@convention(thin) () -> ()
return %1 : $()
}
sil shared @qux : $@convention(thin) () -> () {
bb0:
%1 = tuple ()
return %1 : $()
}
sil hidden @fred : $@convention(thin) () -> () {
bb0:
%0 = function_ref @qux : $@convention(thin) () -> ()
%1 = apply %0() : $@convention(thin) () -> ()
return %1 : $()
}
sil @frieda : $@convention(thin) () -> () {
bb0:
%1 = tuple ()
return %1 : $()
}
// CHECK-macho: @llvm.used = appending global [2 x i8*] [i8* bitcast (void ()* @frieda to i8*), i8* bitcast (i16* @__swift_reflection_version to i8*)], section "llvm.metadata"
// CHECK-elf: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @frieda to i8*), i8* bitcast (i16* @__swift_reflection_version to i8*), i8* getelementptr inbounds ([0 x i8], [0 x i8]* @_swift1_autolink_entries, i32 0, i32 0)], section "llvm.metadata"
// CHECK: define linkonce_odr hidden swiftcc void @qux()
// CHECK: define hidden swiftcc void @fred()
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc void @frieda()
// NEGATIVE-NOT: @foo
// NEGATIVE-NOT: @bar
// NEGATIVE-NOT: @baz