Files
swift-mirror/test/ClangModules/attr-swift_name.swift
Doug Gregor fa3bb96f85 Clang importer: allow the swift_name attribute to map any name.
This is functional for arbitrary Objective-C properties and methods
(the subject of rdar://problem/22214302), as well as for changing the
argument labels of C functions. However, it does not work when the
name of a global is changed because name lookup initiated from
Swift goes through the Swift lookup table. Fixes
rdar://problem/22214302 but is only a step toward
rdar://problem/17184411.

Swift SVN r32670
2015-10-13 21:12:28 +00:00

27 lines
799 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules -Xcc -w -parse %s 2>&1 | FileCheck %s
// REQUIRES: objc_interop
// CHECK-NOT: warning:
import ObjCIRExtras
func test(i: Int) {
let t = SwiftNameTest()
t.theMethod(number: i)
_ = t.renamedSomeProp
// We only see these two warnings because Clang can catch the other invalid
// cases, and marks the attribute as invalid ahead of time.
// CHECK: warning: too few parameters in swift_name attribute (expected 2; got 1)
// CHECK: + (instancetype)g:(id)x outParam:(int *)foo SWIFT_NAME(init(g:));
// CHECK: warning: too few parameters in swift_name attribute (expected 2; got 1)
// CHECK: + (instancetype)testW:(id)x out:(id *)outObject SWIFT_NAME(ww(_:));
}
// CHECK-NOT: warning: