Skip to content

Commit c8a7a44

Browse files
committed
Runtime: Include source location information in log messages about deprecated implicit Objective-C entry points.
Make it easier for migration by pinpointing exactly where to insert @objc to keep the entry points in Swift 4 mode. rdar://problem/32230003
1 parent cc389eb commit c8a7a44

File tree

10 files changed

+164
-48
lines changed

10 files changed

+164
-48
lines changed

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ FUNCTION(GetInitializedObjCClass, swift_getInitializedObjCClass, RegisterPreserv
12421242
FUNCTION(Swift3ImplicitObjCEntrypoint, swift_objc_swift3ImplicitObjCEntrypoint,
12431243
DefaultCC,
12441244
RETURNS(VoidTy),
1245-
ARGS(ObjCPtrTy, ObjCSELTy),
1245+
ARGS(ObjCPtrTy, ObjCSELTy, Int8PtrTy, SizeTy, SizeTy, SizeTy),
12461246
ATTRS(NoUnwind))
12471247

12481248
#endif

lib/AST/Builtins.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,9 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
17831783
return getTSanInoutAccess(Context, Id);
17841784

17851785
case BuiltinValueKind::Swift3ImplicitObjCEntrypoint:
1786-
return getBuiltinFunction(Id, {}, TupleType::getEmpty(Context));
1786+
return getBuiltinFunction(Id,
1787+
{},
1788+
TupleType::getEmpty(Context));
17871789
}
17881790

17891791
llvm_unreachable("bad builtin value!");

lib/IRGen/GenBuiltin.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -860,20 +860,30 @@ if (Builtin.ID == BuiltinValueKind::id) { \
860860
}
861861

862862
if (Builtin.ID == BuiltinValueKind::Swift3ImplicitObjCEntrypoint) {
863-
llvm::Value *args[2];
863+
llvm::Value *entrypointArgs[6];
864864
auto argIter = IGF.CurFn->arg_begin();
865865

866866
// self
867-
args[0] = &*argIter++;
868-
if (args[0]->getType() != IGF.IGM.ObjCPtrTy)
869-
args[0] = IGF.Builder.CreateBitCast(args[0], IGF.IGM.ObjCPtrTy);
867+
entrypointArgs[0] = &*argIter++;
868+
if (entrypointArgs[0]->getType() != IGF.IGM.ObjCPtrTy)
869+
entrypointArgs[0] = IGF.Builder.CreateBitCast(entrypointArgs[0], IGF.IGM.ObjCPtrTy);
870870

871871
// _cmd
872-
args[1] = &*argIter;
873-
if (args[1]->getType() != IGF.IGM.ObjCSELTy)
874-
args[1] = IGF.Builder.CreateBitCast(args[1], IGF.IGM.ObjCSELTy);
875-
876-
IGF.Builder.CreateCall(IGF.IGM.getSwift3ImplicitObjCEntrypointFn(), args);
872+
entrypointArgs[1] = &*argIter;
873+
if (entrypointArgs[1]->getType() != IGF.IGM.ObjCSELTy)
874+
entrypointArgs[1] = IGF.Builder.CreateBitCast(entrypointArgs[1], IGF.IGM.ObjCSELTy);
875+
876+
// Filename pointer
877+
entrypointArgs[2] = args.claimNext();
878+
// Filename length
879+
entrypointArgs[3] = args.claimNext();
880+
// Line
881+
entrypointArgs[4] = args.claimNext();
882+
// Column
883+
entrypointArgs[5] = args.claimNext();
884+
885+
IGF.Builder.CreateCall(IGF.IGM.getSwift3ImplicitObjCEntrypointFn(),
886+
entrypointArgs);
877887
return;
878888
}
879889

lib/SILGen/SILGenBridging.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,23 @@ void SILGenFunction::emitNativeToForeignThunk(SILDeclRef thunk) {
10501050
if (attr->isSwift3Inferred() &&
10511051
!decl->getAttrs().hasAttribute<DynamicAttr>() &&
10521052
!getASTContext().LangOpts.isSwiftVersion3()) {
1053-
B.createBuiltin(loc, getASTContext().getIdentifier("swift3ImplicitObjCEntrypoint"),
1054-
getModule().Types.getEmptyTupleType(), { }, { });
1053+
1054+
// Get the starting source location of the declaration so we can say
1055+
// exactly where to stick '@objc'.
1056+
SourceLoc objcInsertionLoc =
1057+
decl->getAttributeInsertionLoc(/*modifier*/ false);
1058+
1059+
auto objcInsertionLocArgs
1060+
= emitSourceLocationArgs(objcInsertionLoc, loc);
1061+
1062+
B.createBuiltin(loc,
1063+
getASTContext().getIdentifier("swift3ImplicitObjCEntrypoint"),
1064+
getModule().Types.getEmptyTupleType(), { }, {
1065+
objcInsertionLocArgs.filenameStartPointer.forward(*this),
1066+
objcInsertionLocArgs.filenameLength.forward(*this),
1067+
objcInsertionLocArgs.line.forward(*this),
1068+
objcInsertionLocArgs.column.forward(*this)
1069+
});
10551070
}
10561071
}
10571072
}

lib/SILGen/SILGenConvert.cpp

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,18 @@ getOptionalSomeValue(SILLocation loc, ManagedValue value,
135135
return emitManagedRValueWithCleanup(result, optTL);
136136
}
137137

138-
static void emitSourceLocationArgs(SILGenFunction &gen,
139-
SILLocation loc,
140-
ManagedValue (&args)[4]) {
141-
auto &ctx = gen.getASTContext();
142-
auto sourceLoc = loc.getSourceLoc();
138+
auto SILGenFunction::emitSourceLocationArgs(SourceLoc sourceLoc,
139+
SILLocation emitLoc)
140+
-> SourceLocArgs {
141+
auto &ctx = getASTContext();
143142

144143
StringRef filename = "";
145144
unsigned line = 0;
145+
unsigned column = 0;
146146
if (sourceLoc.isValid()) {
147147
unsigned bufferID = ctx.SourceMgr.findBufferContainingLoc(sourceLoc);
148148
filename = ctx.SourceMgr.getIdentifierForBuffer(bufferID);
149-
line = ctx.SourceMgr.getLineAndColumn(sourceLoc).first;
149+
std::tie(line, column) = ctx.SourceMgr.getLineAndColumn(sourceLoc);
150150
}
151151

152152
bool isASCII = true;
@@ -160,19 +160,24 @@ static void emitSourceLocationArgs(SILGenFunction &gen,
160160
auto wordTy = SILType::getBuiltinWordType(ctx);
161161
auto i1Ty = SILType::getBuiltinIntegerType(1, ctx);
162162

163-
// File
164-
SILValue literal = gen.B.createStringLiteral(loc, filename,
165-
StringLiteralInst::Encoding::UTF8);
166-
args[0] = ManagedValue::forUnmanaged(literal);
163+
SourceLocArgs result;
164+
SILValue literal = B.createStringLiteral(emitLoc, filename,
165+
StringLiteralInst::Encoding::UTF8);
166+
result.filenameStartPointer = ManagedValue::forUnmanaged(literal);
167167
// File length
168-
literal = gen.B.createIntegerLiteral(loc, wordTy, filename.size());
169-
args[1] = ManagedValue::forUnmanaged(literal);
168+
literal = B.createIntegerLiteral(emitLoc, wordTy, filename.size());
169+
result.filenameLength = ManagedValue::forUnmanaged(literal);
170170
// File is ascii
171-
literal = gen.B.createIntegerLiteral(loc, i1Ty, isASCII);
172-
args[2] = ManagedValue::forUnmanaged(literal);
171+
literal = B.createIntegerLiteral(emitLoc, i1Ty, isASCII);
172+
result.filenameIsAscii = ManagedValue::forUnmanaged(literal);
173173
// Line
174-
literal = gen.B.createIntegerLiteral(loc, wordTy, line);
175-
args[3] = ManagedValue::forUnmanaged(literal);
174+
literal = B.createIntegerLiteral(emitLoc, wordTy, line);
175+
result.line = ManagedValue::forUnmanaged(literal);
176+
// Column
177+
literal = B.createIntegerLiteral(emitLoc, wordTy, column);
178+
result.column = ManagedValue::forUnmanaged(literal);
179+
180+
return result;
176181
}
177182

178183
ManagedValue
@@ -204,10 +209,15 @@ SILGenFunction::emitPreconditionOptionalHasValue(SILLocation loc,
204209
// Call the standard library implementation of _diagnoseUnexpectedNilOptional.
205210
if (auto diagnoseFailure =
206211
getASTContext().getDiagnoseUnexpectedNilOptional(nullptr)) {
207-
ManagedValue args[4];
208-
emitSourceLocationArgs(*this, loc, args);
212+
auto args = emitSourceLocationArgs(loc.getSourceLoc(), loc);
209213

210-
emitApplyOfLibraryIntrinsic(loc, diagnoseFailure, SubstitutionMap(), args,
214+
emitApplyOfLibraryIntrinsic(loc, diagnoseFailure, SubstitutionMap(),
215+
{
216+
args.filenameStartPointer,
217+
args.filenameLength,
218+
args.filenameIsAscii,
219+
args.line
220+
},
211221
SGFContext());
212222
}
213223

lib/SILGen/SILGenFunction.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,23 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction
869869
ManagedValue getOptionalSomeValue(SILLocation loc, ManagedValue value,
870870
const TypeLowering &optTL);
871871

872+
struct SourceLocArgs {
873+
ManagedValue filenameStartPointer,
874+
filenameLength,
875+
filenameIsAscii,
876+
line,
877+
column;
878+
};
879+
880+
/// Emit raw lowered arguments for a runtime diagnostic to report the given
881+
/// source location:
882+
/// - The first three arguments are the components necessary to construct
883+
/// a StaticString for the filename: start pointer, length, and
884+
/// "is ascii" bit.
885+
/// - The fourth argument is the line number.
886+
SourceLocArgs
887+
emitSourceLocationArgs(SourceLoc loc, SILLocation emitLoc);
888+
872889
/// \brief Emit a call to the library intrinsic _doesOptionalHaveValue.
873890
///
874891
/// The result is a Builtin.Int1.

stdlib/public/runtime/SwiftObject.mm

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,10 @@ static bool usesNativeSwiftReferenceCounting_nonNull(
13621362

13631363
SWIFT_CC(swift)
13641364
SWIFT_RUNTIME_EXPORT
1365-
void swift_objc_swift3ImplicitObjCEntrypoint(id self, SEL selector) {
1365+
void swift_objc_swift3ImplicitObjCEntrypoint(id self, SEL selector,
1366+
const char *filename,
1367+
size_t filenameLength,
1368+
size_t line, size_t column) {
13661369
// Figure out how much reporting we want by querying the environment
13671370
// variable SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT. We have four meaningful
13681371
// levels:
@@ -1398,10 +1401,17 @@ void swift_objc_swift3ImplicitObjCEntrypoint(id self, SEL selector) {
13981401
bool isInstanceMethod = !class_isMetaClass(object_getClass(self));
13991402
void (*reporter)(uint32_t, const char *, ...) =
14001403
reportLevel > 2 ? swift::fatalError : swift::warning;
1404+
1405+
if (filenameLength > INT_MAX)
1406+
filenameLength = INT_MAX;
1407+
14011408
reporter(
14021409
flags,
1403-
"***Swift runtime: entrypoint %c[%s %s] generated by implicit @objc "
1404-
"inference is deprecated and will be removed in Swift 4\n",
1410+
"*** %*s:%zu:%zu: implicit Objective-C entrypoint %c[%s %s] "
1411+
"is deprecated and will be removed in Swift 4; "
1412+
"add explicit '@objc' to the declaration to emit the Objective-C "
1413+
"entrypoint in Swift 4 and suppress this message",
1414+
(int)filenameLength, filename, line, column,
14051415
isInstanceMethod ? '-' : '+',
14061416
class_getName([self class]),
14071417
sel_getName(selector));

test/IRGen/objc_deprecated_objc_thunks.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// REQUIRES: CPU=x86_64
66
// REQUIRES: objc_interop
77

8+
// CHECK-SWIFT4: [[FILENAME_STR:@.*]] = private unnamed_addr constant {{.*}}.swift\00"
9+
810
import Foundation
911

1012
class ObjCSubclass : NSObject {
@@ -14,8 +16,8 @@ class ObjCSubclass : NSObject {
1416
// CHECK-SWIFT4-LABEL: define hidden void @_T0016objc_deprecated_A7_thunks12ObjCSubclassC3fooyyFTo(%0*, i8*)
1517
// CHECK-SWIFT4: entry:
1618
// CHECK-SWIFT4: [[SELF:%[0-9]+]] = bitcast %0* %0 to %objc_object*
17-
// CHECK-SWIFT4-NEXT: call void @swift_objc_swift3ImplicitObjCEntrypoint(%objc_object* [[SELF]], i8* %1)
19+
// CHECK-SWIFT4-NEXT: call void @swift_objc_swift3ImplicitObjCEntrypoint(%objc_object* [[SELF]], i8* %1, i8* getelementptr inbounds ({{.*}}[[FILENAME_STR]]{{.*}}), i64 [[FILENAME_LENGTH:[0-9]+]], i64 13, i64 3)
1820

1921
// CHECK-SWIFT3-LABEL: define hidden void @_T0016objc_deprecated_A7_thunks12ObjCSubclassC3fooyyFTo(%0*, i8*)
2022
// CHECK-SWIFT3: entry:
21-
// CHECK-SWIFT3-NOT: call void @swift_objc_swift3ImplicitObjCEntrypoint(%objc_object* [[SELF]], i8* %1)
23+
// CHECK-SWIFT3-NOT: call void @swift_objc_swift3ImplicitObjCEntrypoint

test/Interpreter/SDK/objc_swift3_deprecated_objc_inference.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ DeprecatedObjCInferenceTestSuite.test("messagingObjCInference") {
4242
// CHECK_CRASH: ---Begin
4343
fputs("---Begin\n", stderr)
4444

45-
// CHECK_WARNINGS: ***Swift runtime: entrypoint -[a.MyClass foo] generated by implicit @objc inference is deprecated and will be removed in Swift 4
46-
// CHECK_CRASH: ***Swift runtime: entrypoint -[a.MyClass foo] generated by implicit @objc inference is deprecated and will be removed in Swift 4
45+
// CHECK_WARNINGS: .swift:26:3: implicit Objective-C entrypoint -[a.MyClass foo]
46+
// CHECK_CRASH: .swift:26:3: implicit Objective-C entrypoint -[a.MyClass foo]
4747
x.perform(Selector(fooSel))
4848

49-
// CHECK_WARNINGS: ***Swift runtime: entrypoint +[a.MyClass bar] generated by implicit @objc inference is deprecated and will be removed in Swift 4
49+
// CHECK_WARNINGS: .swift:27:3: implicit Objective-C entrypoint +[a.MyClass bar]
5050
type(of: x).perform(Selector(barSel))
5151

5252
// CHECK_NOTHING-NEXT: ---End

test/SILGen/objc_deprecated_objc_thunks.swift

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,89 @@ import Foundation
99
class ObjCSubclass : NSObject {
1010
// CHECK-SWIFT4-LABEL: sil hidden [thunk] @_T0016objc_deprecated_A7_thunks12ObjCSubclassCACyt7nothing_tcfcTo : $@convention(objc_method) (@owned ObjCSubclass) -> @owned ObjCSubclass {
1111
// CHECK-SWIFT4: bb0(%0 : $ObjCSubclass):
12-
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"() : $()
12+
// CHECK-SWIFT4-NEXT: [[FILENAME:%.*]] = [[FILENAME_LITERAL:string_literal.*"]]
13+
// CHECK-SWIFT4-NEXT: [[LENGTH:%.*]] = integer_literal
14+
// CHECK-SWIFT4-NEXT: [[IS_ASCII:%.*]] = integer_literal
15+
// CHECK-SWIFT4-NEXT: [[LINE:%.*]] = integer_literal $Builtin.Word, [[@LINE+3]]
16+
// CHECK-SWIFT4-NEXT: [[COLUMN:%.*]] = integer_literal $Builtin.Word, 3
17+
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"([[FILENAME]] : $Builtin.RawPointer, [[LENGTH]] : $Builtin.Word, [[LINE]] : $Builtin.Word, [[COLUMN]] : $Builtin.Word) : $()
1318
init(nothing: ()) { super.init() }
1419

1520
// CHECK-SWIFT4-LABEL: sil hidden [thunk] @_T0016objc_deprecated_A7_thunks12ObjCSubclassC3fooyyFTo : $@convention(objc_method) (ObjCSubclass) -> ()
1621
// CHECK-SWIFT4: bb0(%0 : $ObjCSubclass):
17-
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"() : $()
22+
// CHECK-SWIFT4-NEXT: [[FILENAME:%.*]] = [[FILENAME_LITERAL]]
23+
// CHECK-SWIFT4-NEXT: [[LENGTH:%.*]] = integer_literal
24+
// CHECK-SWIFT4-NEXT: [[IS_ASCII:%.*]] = integer_literal
25+
// CHECK-SWIFT4-NEXT: [[LINE:%.*]] = integer_literal $Builtin.Word, [[@LINE+3]]
26+
// CHECK-SWIFT4-NEXT: [[COLUMN:%.*]] = integer_literal $Builtin.Word, 3
27+
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"([[FILENAME]] : $Builtin.RawPointer, [[LENGTH]] : $Builtin.Word, [[LINE]] : $Builtin.Word, [[COLUMN]] : $Builtin.Word) : $()
1828
func foo() { }
1929

2030
// CHECK-SWIFT4-LABEL: sil hidden [thunk] @_T0016objc_deprecated_A7_thunks12ObjCSubclassC3barSo8NSObjectCSgfgTo : $@convention(objc_method) (ObjCSubclass) -> @autoreleased Optional<NSObject>
2131
// CHECK-SWIFT4: bb0(%0 : $ObjCSubclass):
22-
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"() : $()
32+
// CHECK-SWIFT4-NEXT: [[FILENAME:%.*]] = [[FILENAME_LITERAL]]
33+
// CHECK-SWIFT4-NEXT: [[LENGTH:%.*]] = integer_literal
34+
// CHECK-SWIFT4-NEXT: [[IS_ASCII:%.*]] = integer_literal
35+
// CHECK-SWIFT4-NEXT: [[LINE:%.*]] = integer_literal $Builtin.Word, [[@LINE+12]]
36+
// CHECK-SWIFT4-NEXT: [[COLUMN:%.*]] = integer_literal $Builtin.Word, 3
37+
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"([[FILENAME]] : $Builtin.RawPointer, [[LENGTH]] : $Builtin.Word, [[LINE]] : $Builtin.Word, [[COLUMN]] : $Builtin.Word) : $()
2338

2439
// CHECK-SWIFT4-LABEL: sil hidden [thunk] @_T0016objc_deprecated_A7_thunks12ObjCSubclassC3barSo8NSObjectCSgfsTo : $@convention(objc_method) (Optional<NSObject>, ObjCSubclass) -> () {
2540
// CHECK-SWIFT4: %0 : $Optional<NSObject>, %1 : $ObjCSubclass
26-
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"() : $()
41+
// CHECK-SWIFT4-NEXT: [[FILENAME:%.*]] = [[FILENAME_LITERAL]]
42+
// CHECK-SWIFT4-NEXT: [[LENGTH:%.*]] = integer_literal
43+
// CHECK-SWIFT4-NEXT: [[IS_ASCII:%.*]] = integer_literal
44+
// CHECK-SWIFT4-NEXT: [[LINE:%.*]] = integer_literal $Builtin.Word, [[@LINE+3]]
45+
// CHECK-SWIFT4-NEXT: [[COLUMN:%.*]] = integer_literal $Builtin.Word, 3
46+
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"([[FILENAME]] : $Builtin.RawPointer, [[LENGTH]] : $Builtin.Word, [[LINE]] : $Builtin.Word, [[COLUMN]] : $Builtin.Word) : $()
2747
var bar: NSObject? = nil
2848

2949
// CHECK-SWIFT4-LABEL: sil hidden [thunk] @_T0016objc_deprecated_A7_thunks12ObjCSubclassC9subscriptyXlSicfgTo : $@convention(objc_method) (Int, ObjCSubclass) -> @autoreleased AnyObject
3050
// CHECK-SWIFT4: bb0(%0 : $Int, %1 : $ObjCSubclass):
31-
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"() : $()
51+
// CHECK-SWIFT4-NEXT: [[FILENAME:%.*]] = [[FILENAME_LITERAL]]
52+
// CHECK-SWIFT4-NEXT: [[LENGTH:%.*]] = integer_literal
53+
// CHECK-SWIFT4-NEXT: [[IS_ASCII:%.*]] = integer_literal
54+
// CHECK-SWIFT4-NEXT: [[LINE:%.*]] = integer_literal $Builtin.Word, [[@LINE+12]]
55+
// CHECK-SWIFT4-NEXT: [[COLUMN:%.*]] = integer_literal $Builtin.Word, 3
56+
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"([[FILENAME]] : $Builtin.RawPointer, [[LENGTH]] : $Builtin.Word, [[LINE]] : $Builtin.Word, [[COLUMN]] : $Builtin.Word) : $()
3257

3358
// CHECK-SWIFT4-LABEL: sil hidden [thunk] @_T0016objc_deprecated_A7_thunks12ObjCSubclassC9subscriptyXlSicfsTo : $@convention(objc_method) (AnyObject, Int, ObjCSubclass) ->
3459
// CHECK-SWIFT4: bb0(%0 : $AnyObject, %1 : $Int, %2 : $ObjCSubclass):
35-
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"() : $()
60+
// CHECK-SWIFT4-NEXT: [[FILENAME:%.*]] = [[FILENAME_LITERAL]]
61+
// CHECK-SWIFT4-NEXT: [[LENGTH:%.*]] = integer_literal
62+
// CHECK-SWIFT4-NEXT: [[IS_ASCII:%.*]] = integer_literal
63+
// CHECK-SWIFT4-NEXT: [[LINE:%.*]] = integer_literal $Builtin.Word, [[@LINE+3]]
64+
// CHECK-SWIFT4-NEXT: [[COLUMN:%.*]] = integer_literal $Builtin.Word, 3
65+
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"([[FILENAME]] : $Builtin.RawPointer, [[LENGTH]] : $Builtin.Word, [[LINE]] : $Builtin.Word, [[COLUMN]] : $Builtin.Word) : $()
3666
subscript (i: Int) -> AnyObject { get { return self } set { } }
67+
68+
// CHECK-SWIFT4-LABEL: sil hidden [thunk] @_T0016objc_deprecated_A7_thunks12ObjCSubclassC9staticFooyyFZTo
69+
// CHECK-SWIFT4: bb0
70+
// CHECK-SWIFT4-NEXT: [[FILENAME:%.*]] = [[FILENAME_LITERAL]]
71+
// CHECK-SWIFT4-NEXT: [[LENGTH:%.*]] = integer_literal
72+
// CHECK-SWIFT4-NEXT: [[IS_ASCII:%.*]] = integer_literal
73+
// CHECK-SWIFT4-NEXT: [[LINE:%.*]] = integer_literal $Builtin.Word, [[@LINE+3]]
74+
// CHECK-SWIFT4-NEXT: [[COLUMN:%.*]] = integer_literal $Builtin.Word, 3
75+
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"([[FILENAME]] : $Builtin.RawPointer, [[LENGTH]] : $Builtin.Word, [[LINE]] : $Builtin.Word, [[COLUMN]] : $Builtin.Word) : $()
76+
static func staticFoo() {}
77+
78+
// CHECK-SWIFT4-LABEL: sil hidden [thunk] [noinline] @_T0016objc_deprecated_A7_thunks12ObjCSubclassC13dontInlineFooyyFTo
79+
// CHECK-SWIFT4: bb0
80+
// CHECK-SWIFT4-NEXT: [[FILENAME:%.*]] = [[FILENAME_LITERAL]]
81+
// CHECK-SWIFT4-NEXT: [[LENGTH:%.*]] = integer_literal
82+
// CHECK-SWIFT4-NEXT: [[IS_ASCII:%.*]] = integer_literal
83+
// CHECK-SWIFT4-NEXT: [[LINE:%.*]] = integer_literal $Builtin.Word, [[@LINE+3]]
84+
// CHECK-SWIFT4-NEXT: [[COLUMN:%.*]] = integer_literal $Builtin.Word, 3
85+
// CHECK-SWIFT4-NEXT: builtin "swift3ImplicitObjCEntrypoint"([[FILENAME]] : $Builtin.RawPointer, [[LENGTH]] : $Builtin.Word, [[LINE]] : $Builtin.Word, [[COLUMN]] : $Builtin.Word) : $()
86+
@inline(never) func dontInlineFoo() {}
3787
}
3888

3989
extension ObjCSubclass {
4090
// CHECK-SWIFT4-LABEL: sil hidden [thunk] @_T0016objc_deprecated_A7_thunks12ObjCSubclassC13falsePositiveyyFTo : $@convention(objc_method) (ObjCSubclass) -> ()
4191
// CHECK-SWIFT4: bb0(%0 : $ObjCSubclass):
42-
// CHECK-SWIFT4-NOT: builtin "swift3ImplicitObjCEntrypoint"() : $()
92+
// CHECK-SWIFT4-NOT: builtin "swift3ImplicitObjCEntrypoint"
4393
// CHECK-SWIFT4: return
4494
func falsePositive() { }
4595
}
4696

47-
// CHECK-SWIFT3-NOT: builtin "swift3ImplicitObjCEntrypoint"() : $()
97+
// CHECK-SWIFT3-NOT: builtin "swift3ImplicitObjCEntrypoint"

0 commit comments

Comments
 (0)