mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Change the mangling of accessors to have a variable or subscript node as their only child node, while subscript nodes no longer contain a decl name.
25 lines
1.2 KiB
Swift
25 lines
1.2 KiB
Swift
// RUN: %target-swift-frontend -emit-silgen -enable-sil-ownership %s | %FileCheck %s -check-prefix=MAIN
|
|
// RUN: %target-swift-frontend -parse-as-library -emit-silgen -enable-sil-ownership %s | %FileCheck %s -check-prefix=LIBRARY
|
|
|
|
// The following code is valid as a library or as a main source file. Script
|
|
// variables should be accessed directly, whereas library global variables
|
|
// should use the accessor function. Static properties always go through an
|
|
// accessor.
|
|
|
|
var globalProp = 0
|
|
|
|
struct Fooo {
|
|
static var staticProp = 0
|
|
}
|
|
|
|
// MAIN: sil hidden @_T018lazy_global_access8usePropsSi_SityF : $@convention(thin) () -> (Int, Int) {
|
|
// MAIN: global_addr @_T018lazy_global_access0B4PropSivp : $*Int
|
|
// MAIN: function_ref @_T018lazy_global_access4FoooV10staticPropSivau : $@convention(thin) () -> Builtin.RawPointer
|
|
// LIBRARY: sil hidden @_T018lazy_global_access8usePropsSi_SityF : $@convention(thin) () -> (Int, Int) {
|
|
// LIBRARY: function_ref @_T018lazy_global_access0B4PropSivau : $@convention(thin) () -> Builtin.RawPointer
|
|
// LIBRARY: function_ref @_T018lazy_global_access4FoooV10staticPropSivau : $@convention(thin) () -> Builtin.RawPointer
|
|
func useProps() -> (Int, Int) {
|
|
return (globalProp, Fooo.staticProp)
|
|
}
|
|
|