mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Something has changed with newer versions of LLVM so that the stdlib/SwiftObjectNSObject.swift test fails on the master-next branch because the @objc thunk functions all get merged together. That is a good thing for code size but it breaks some of the checks in this test that compare the function pointers to verify that overrides are correct. Make each function different so they cannot be merged.
47 lines
1.7 KiB
Swift
47 lines
1.7 KiB
Swift
//===--- SwiftObjectNSObject.swift - Test SwiftObject's NSObject interop --===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// RUN: %empty-directory(%t)
|
|
//
|
|
// RUN: %target-clang %S/Inputs/SwiftObjectNSObject/SwiftObjectNSObject.m -c -o %t/SwiftObjectNSObject.o -g
|
|
// RUN: %target-build-swift %s -I %S/Inputs/SwiftObjectNSObject/ -Xlinker %t/SwiftObjectNSObject.o -o %t/SwiftObjectNSObject
|
|
// RUN: %target-run %t/SwiftObjectNSObject 2>&1 | %FileCheck %s
|
|
// REQUIRES: executable_test
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
import Foundation
|
|
|
|
class C {
|
|
@objc func cInstanceMethod() -> Int { return 1 }
|
|
@objc class func cClassMethod() -> Int { return 2 }
|
|
@objc func cInstanceOverride() -> Int { return 3 }
|
|
@objc class func cClassOverride() -> Int { return 4 }
|
|
}
|
|
class D : C {
|
|
@objc func dInstanceMethod() -> Int { return 5 }
|
|
@objc class func dClassMethod() -> Int { return 6 }
|
|
@objc override func cInstanceOverride() -> Int { return 7 }
|
|
@objc override class func cClassOverride() -> Int { return 8 }
|
|
}
|
|
|
|
@_silgen_name("TestSwiftObjectNSObject")
|
|
func TestSwiftObjectNSObject(_ c: C, _ d: D)
|
|
|
|
// This check is for NSLog() output from TestSwiftObjectNSObject().
|
|
// CHECK: c ##SwiftObjectNSObject.C##
|
|
// CHECK-NEXT: d ##SwiftObjectNSObject.D##
|
|
// CHECK-NEXT: S ##SwiftObject##
|
|
|
|
TestSwiftObjectNSObject(C(), D())
|
|
// does not return
|