Files
swift-mirror/test/SILOptimizer/globalopt_linkage.swift
Erik Eckstein 695edc020b GlobalOpt: fix linkage and mangling of generated getter functions.
fixes undefined symbol linker errors in case those getter functions are not inlined: rdar://problem/28901478
2016-11-01 12:28:52 -07:00

24 lines
566 B
Swift

// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass=Inliner -emit-sil -primary-file %s | %FileCheck %s
// Check if GlobalOpt generates the getters with the right linkage and the right mangling
struct MyStruct {
static let StaticVar = 10
}
let Global = 27
func testit() -> Int {
return MyStruct.StaticVar + Global
}
_ = testit()
// CHECK: sil hidden @{{.*}}testit
// CHECK: // MyStruct.StaticVar.getter
// CHECK-NEXT: sil private [fragile] @_{{.*}}StaticVar
// CHECK: // Global.getter
// CHECK-NEXT: sil private [fragile] @_{{.*}}Global