Files
swift-mirror/test/SIL/Serialization/asmname.sil
Doug Gregor 3e1ea3c0f7 [SIL] Add asmname attribute to SIL functions and global variables
The asmname attribute allows one to specify the name that will be used
when lowering a given SIL declaration to LLVM IR. It is not currently
exposed in the surface language.

Make sure this attribute round-trips through the parser and
serialization.

Part of rdar://137014448O.
2025-10-15 20:44:09 -07:00

17 lines
740 B
Plaintext

// First parse this and then emit a *.sib. Then read in the *.sib, then recreate
// RUN: %empty-directory(%t)
// RUN: %target-sil-opt -sil-print-types %s -emit-sib -o %t/tmp.sib -module-name borrow
// RUN: %target-sil-opt -sil-print-types %t/tmp.sib -o %t/tmp.2.sib -module-name borrow
// RUN: %target-sil-opt -sil-print-types %t/tmp.2.sib -module-name asmname -emit-sorted-sil | %FileCheck %s
import Swift
// CHECK: sil_global [asmname "v1"] @$s4main13renamedGlobalSivp : $Int
sil_global [asmname "v1"] @$s4main13renamedGlobalSivp : $Int
// CHECK: sil [asmname "f1"] @$s4main15renamedFunctionyyF : $@convention(thin) () -> ()
sil [asmname "f1"] @$s4main15renamedFunctionyyF : $@convention(thin) () -> () {
%0 = tuple ()
return %0
}