mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The reason why is that we want to distinguish inbetween SILFunction's that are marked as unspecified by SILGen and those that are parsed from textual SIL that do not have any specified isolation. This will make it easier to write nice FileCheck tests against SILGen output on what is the inferred isolation for various items. NFCI.
35 lines
1.1 KiB
Swift
35 lines
1.1 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-module -o %t %S/Inputs/def_global.swift
|
|
// RUN: %target-swift-emit-silgen -Xllvm -sil-full-demangle -parse-as-library -I %t %s | %FileCheck %s
|
|
//
|
|
// Test that SILGen uses the "global_init" attribute for all global
|
|
// variable addressors.
|
|
|
|
import def_global
|
|
|
|
let InternalConst = 42
|
|
// CHECK-NOT: [global_init]
|
|
// CHECK: // global_init_attribute.InternalConst.unsafeMutableAddressor : Swift.Int
|
|
// CHECK-NEXT: // Isolation:
|
|
// CHECK-NEXT: sil hidden [global_init] [ossa] @$s21global_init_attribute13InternalConstSivau
|
|
|
|
func foo() -> Int {
|
|
return ExportedVar
|
|
}
|
|
|
|
func bar(i: Int) {
|
|
ExportedVar = i
|
|
}
|
|
|
|
// CHECK-NOT: [global_init]
|
|
// CHECK: // def_global.ExportedVar.unsafeMutableAddressor : Swift.Int
|
|
// CHECK-NEXT: // Isolation:
|
|
// CHECK-NEXT: sil [global_init] @$s10def_global11ExportedVarSivau
|
|
|
|
var InternalFoo = foo()
|
|
|
|
// CHECK-NOT: [global_init]
|
|
// CHECK: // global_init_attribute.InternalFoo.unsafeMutableAddressor : Swift.Int
|
|
// CHECK-NEXT: // Isolation:
|
|
// CHECK-NEXT: sil hidden [global_init] [ossa] @$s21global_init_attribute11InternalFooSivau
|