Revision 42e827e6e7247224c068a9dce8f6eabd2ab892ba authored by Devin Coughlin on 21 January 2016, 00:12:56 UTC, committed by Devin Coughlin on 21 January 2016, 01:22:15 UTC
1 parent ac1f5a6
Raw File
weak_import.swift
// RUN: rm -rf %t && mkdir %t
// RUN: %build-irgen-test-overlays
//
// Specify explicit target triples for the deployment target to test weak
// linking for a symbol introduced in OS X 10.10.
//
// RUN: %target-swift-frontend(mock-sdk: -target x86_64-apple-macosx10.9  -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck -check-prefix=CHECK-10_9 %s
// RUN: %target-swift-frontend(mock-sdk: -target x86_64-apple-macosx10.10 -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck -check-prefix=CHECK-10_10 %s

// REQUIRES: OS=macosx
// REQUIRES: objc_interop

// FIXME: This test in written in Swift because the SIL parser fails
// when referencing weak_variable.

import Foundation

// CHECK-10_9: @weak_variable = extern_weak global
// CHECK-10_10: @weak_variable = extern_weak global

// CHECK-10_9: @"OBJC_CLASS_$_NSUserNotificationAction" = extern_weak global %objc_class
// CHECK-10_10: @"OBJC_CLASS_$_NSUserNotificationAction" = external global %objc_class

func testObjCClass() {
  if #available(OSX 10.10, *) {
    let action = NSUserNotificationAction()
  }
}

func testGlobalVariable() {
  let i = weak_variable
}
back to top