Files
swift-mirror/test/SILGen/global_init_attribute.swift
Dmitri Hrybenko 3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00

33 lines
1007 B
Swift

// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_global.swift
// RUN: %target-swift-frontend -parse-as-library -emit-silgen -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: sil hidden [global_init] @_TF21global_init_attributeau13InternalConstSi
func foo() -> Int {
return ExportedVar
}
func bar(i: Int) {
ExportedVar = i
}
// CHECK-NOT: [global_init]
// CHECK: // def_global.ExportedVar.unsafeMutableAddressor : Swift.Int
// CHECK-NEXT: sil [global_init] @_TF10def_globalau11ExportedVarSi
var InternalFoo = foo()
// CHECK-NOT: [global_init]
// CHECK: // global_init_attribute.InternalFoo.unsafeMutableAddressor : Swift.Int
// CHECK-NEXT: sil hidden [global_init] @_TF21global_init_attributeau11InternalFooSi