Skip to content

Commit 0e7af7a

Browse files
authored
Merge pull request #41217 from zoecarver/cleanup-and-fixes-for-function-templates
2 parents 5d1ddbf + 2d4b2eb commit 0e7af7a

13 files changed

+122
-117
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4672,8 +4672,7 @@ clang::FunctionDecl *ClangImporter::instantiateCXXFunctionTemplate(
46724672
ctx.Diags.diagnose(SourceLoc(),
46734673
diag::unable_to_convert_generic_swift_types.ID,
46744674
{func->getName(), StringRef(failedTypesStr)});
4675-
// Return a valid FunctionDecl but, we'll never use it.
4676-
return func->getAsFunction();
4675+
return nullptr;
46774676
}
46784677

46794678
// Instanciate a specialization of this template using the substitution map.

lib/ClangImporter/ImportType.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19451945
Type swiftParamTy;
19461946
bool isParamTypeImplicitlyUnwrapped = false;
19471947
bool isInOut = false;
1948-
if ((isa<clang::ReferenceType>(paramTy) || isa<clang::PointerType>(paramTy)) &&
1948+
if (isa<clang::PointerType>(paramTy) &&
19491949
isa<clang::TemplateTypeParmType>(paramTy->getPointeeType())) {
19501950
auto pointeeType = paramTy->getPointeeType();
19511951
auto templateParamType = cast<clang::TemplateTypeParmType>(pointeeType);
@@ -1957,6 +1957,13 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19571957
swiftParamTy = genericType->wrapInPointer(pointerKind);
19581958
if (!swiftParamTy)
19591959
return nullptr;
1960+
} else if (isa<clang::ReferenceType>(paramTy) &&
1961+
isa<clang::TemplateTypeParmType>(paramTy->getPointeeType())) {
1962+
auto templateParamType =
1963+
cast<clang::TemplateTypeParmType>(paramTy->getPointeeType());
1964+
swiftParamTy =
1965+
findGenericTypeInGenericDecls(templateParamType, genericParams);
1966+
isInOut = true;
19601967
} else if (auto *templateParamType =
19611968
dyn_cast<clang::TemplateTypeParmType>(paramTy)) {
19621969
swiftParamTy =

lib/Sema/CSApply.cpp

Lines changed: 87 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -149,65 +149,6 @@ substituteFunctionTypeAndParamList(ASTContext &ctx, AbstractFunctionDecl *fdecl,
149149
return {newFnType, newParamList};
150150
}
151151

152-
static ValueDecl *generateSpecializedCXXFunctionTemplate(
153-
ASTContext &ctx, AbstractFunctionDecl *oldDecl, SubstitutionMap subst,
154-
clang::FunctionDecl *specialized) {
155-
auto newFnTypeAndParams = substituteFunctionTypeAndParamList(ctx, oldDecl, subst);
156-
auto newFnType = newFnTypeAndParams.first;
157-
auto paramList = newFnTypeAndParams.second;
158-
159-
SmallVector<ParamDecl *, 4> newParamsWithoutMetatypes;
160-
for (auto param : *paramList ) {
161-
if (isa<FuncDecl>(oldDecl) &&
162-
isa<MetatypeType>(param->getType().getPointer())) {
163-
// Metatype parameters are added synthetically to account for template
164-
// params that don't make it to the function signature. These shouldn't
165-
// exist in the resulting specialized FuncDecl. Note that this doesn't
166-
// affect constructors because all template params for a constructor
167-
// must be in the function signature by design.
168-
continue;
169-
}
170-
newParamsWithoutMetatypes.push_back(param);
171-
}
172-
auto *newParamList =
173-
ParameterList::create(ctx, SourceLoc(), newParamsWithoutMetatypes, SourceLoc());
174-
175-
if (isa<ConstructorDecl>(oldDecl)) {
176-
DeclName ctorName(ctx, DeclBaseName::createConstructor(), newParamList);
177-
auto newCtorDecl = ConstructorDecl::createImported(
178-
ctx, specialized, ctorName, oldDecl->getLoc(),
179-
/*failable=*/false, /*failabilityLoc=*/SourceLoc(),
180-
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
181-
/*throws=*/false, /*throwsLoc=*/SourceLoc(),
182-
newParamList, /*genericParams=*/nullptr,
183-
oldDecl->getDeclContext());
184-
return newCtorDecl;
185-
}
186-
187-
// Generate a name for the specialized function.
188-
std::string newNameStr;
189-
llvm::raw_string_ostream buffer(newNameStr);
190-
std::unique_ptr<clang::MangleContext> mangler(
191-
specialized->getASTContext().createMangleContext());
192-
mangler->mangleName(specialized, buffer);
193-
buffer.flush();
194-
// Add all parameters as empty parameters.
195-
auto newName = DeclName(
196-
ctx, DeclName(ctx.getIdentifier(newNameStr)).getBaseName(), newParamList);
197-
198-
auto newFnDecl = FuncDecl::createImported(
199-
ctx, oldDecl->getLoc(), newName, oldDecl->getNameLoc(),
200-
/*Async=*/false, oldDecl->hasThrows(), newParamList,
201-
newFnType->getResult(), /*GenericParams=*/nullptr,
202-
oldDecl->getDeclContext(), specialized);
203-
if (oldDecl->isStatic()) {
204-
newFnDecl->setStatic();
205-
newFnDecl->setImportAsStaticMember();
206-
}
207-
newFnDecl->setSelfAccessKind(cast<FuncDecl>(oldDecl)->getSelfAccessKind());
208-
return newFnDecl;
209-
}
210-
211152
// Synthesizes the body of a thunk that takes extra metatype arguments and
212153
// skips over them to forward them along to the FuncDecl contained by context.
213154
// This is used when importing a C++ templated function where the template params
@@ -285,8 +226,91 @@ Solution::resolveConcreteDeclRef(ValueDecl *decl,
285226
const_cast<clang::FunctionTemplateDecl *>(
286227
cast<clang::FunctionTemplateDecl>(decl->getClangDecl())),
287228
subst);
288-
auto newDecl = generateSpecializedCXXFunctionTemplate(
289-
decl->getASTContext(), cast<AbstractFunctionDecl>(decl), subst, newFn);
229+
// We failed to specialize this function template. The compiler is going to
230+
// exit soon. Return something valid in the meantime.
231+
if (!newFn)
232+
return ConcreteDeclRef(decl);
233+
234+
auto newDecl = cast_or_null<ValueDecl>(
235+
decl->getASTContext().getClangModuleLoader()->importDeclDirectly(
236+
newFn));
237+
238+
if (auto fn = dyn_cast<AbstractFunctionDecl>(newDecl)) {
239+
// On Windows x86-64 we have to hack around the fact that
240+
// Int -> long long -> Int64. So we re-write the parameters mapping
241+
// Int64 -> Int.
242+
auto triple = decl->getASTContext().LangOpts.Target;
243+
if (triple.isOSWindows() && triple.isArch64Bit() &&
244+
!triple.isWindowsCygwinEnvironment() &&
245+
// Make sure we're substituting in at least one Int or UInt
246+
// (technically not necessary).
247+
llvm::any_of(subst.getReplacementTypes(), [](Type t) {
248+
return t->isEqual(t->getASTContext().getIntType()) ||
249+
t->isEqual(t->getASTContext().getUIntType());
250+
})) {
251+
auto originalFnSubst = cast<AbstractFunctionDecl>(decl)
252+
->getInterfaceType()
253+
->getAs<GenericFunctionType>()
254+
->substGenericArgs(subst);
255+
// The constructor type is a function type as follows:
256+
// (CType.Type) -> (Generic) -> CType
257+
// And a method's function type is as follows:
258+
// (inout CType) -> (Generic) -> Void
259+
// In either case, we only want the result of that function type because that
260+
// is the function type with the generic params that need to be substituted:
261+
// (Generic) -> CType
262+
if (isa<ConstructorDecl>(decl) || decl->isInstanceMember() ||
263+
decl->isStatic())
264+
originalFnSubst = cast<FunctionType>(originalFnSubst->getResult().getPointer());
265+
266+
SmallVector<ParamDecl *, 4> fixedParameters;
267+
unsigned parameterIndex = 0;
268+
for (auto *newFnParam : *fn->getParameters()) {
269+
// If the user substituted this param with an (U)Int, use (U)Int.
270+
auto substParamType =
271+
originalFnSubst->getParams()[parameterIndex].getParameterType();
272+
if (substParamType->isEqual(fn->getASTContext().getIntType()) ||
273+
substParamType->isEqual(fn->getASTContext().getUIntType())) {
274+
auto intParam =
275+
ParamDecl::cloneWithoutType(fn->getASTContext(), newFnParam);
276+
intParam->setInterfaceType(substParamType);
277+
fixedParameters.push_back(intParam);
278+
} else {
279+
fixedParameters.push_back(newFnParam);
280+
}
281+
parameterIndex++;
282+
}
283+
284+
auto fixedParams =
285+
ParameterList::create(fn->getASTContext(), fixedParameters);
286+
fn->setParameters(fixedParams);
287+
288+
// Now fix the result type:
289+
if (originalFnSubst->getResult()->isEqual(
290+
fn->getASTContext().getIntType()) ||
291+
originalFnSubst->getResult()->isEqual(
292+
fn->getASTContext().getUIntType())) {
293+
// Constructors don't have a result.
294+
if (auto func = dyn_cast<FuncDecl>(fn)) {
295+
// We have to rebuild the whole function.
296+
auto newFnDecl = FuncDecl::createImported(
297+
func->getASTContext(), func->getNameLoc(),
298+
func->getName(), func->getNameLoc(),
299+
func->hasAsync(), func->hasThrows(),
300+
fixedParams, originalFnSubst->getResult(),
301+
/*genericParams=*/nullptr, func->getDeclContext(), newFn);
302+
if (func->isStatic()) newFnDecl->setStatic();
303+
if (func->isImportAsStaticMember()) newFnDecl->setImportAsStaticMember();
304+
if (!func->getDeclContext()->isModuleScopeContext()) {
305+
newFnDecl->setSelfAccessKind(func->getSelfAccessKind());
306+
newFnDecl->setSelfIndex(func->getSelfIndex());
307+
}
308+
newDecl = newFnDecl;
309+
}
310+
}
311+
}
312+
}
313+
290314
if (auto fn = dyn_cast<FuncDecl>(decl)) {
291315
if (newFn->getNumParams() != fn->getParameters()->size()) {
292316
// We added additional metatype parameters to aid template
@@ -304,9 +328,10 @@ Solution::resolveConcreteDeclRef(ValueDecl *decl,
304328
thunk->setBodySynthesizer(synthesizeForwardingThunkBody, cast<FuncDecl>(newDecl));
305329
thunk->setSelfAccessKind(fn->getSelfAccessKind());
306330

307-
return ConcreteDeclRef(thunk);
331+
newDecl = thunk;
308332
}
309333
}
334+
310335
return ConcreteDeclRef(newDecl);
311336
}
312337

test/Interop/Cxx/class/constructors-irgen.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ typealias Void = ()
1111
struct UnsafePointer<T> { }
1212
struct UnsafeMutablePointer<T> { }
1313

14+
struct Int { }
15+
struct UInt { }
16+
1417
public func createHasVirtualBase() -> HasVirtualBase {
1518
// ITANIUM_X64: define swiftcc void @"$ss20createHasVirtualBaseSo0bcD0VyF"(%TSo14HasVirtualBaseV* noalias nocapture sret({{.*}}) %0)
1619
// ITANIUM_X64-NOT: define

test/Interop/Cxx/class/constructors-silgen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public func deletedConstructor(a: UnsafeMutablePointer<Int32>) {
6565
// CHECK: apply [[FN]]([[TEMPL]], [[ARG_VAL]]) : $@convention(c) (ArgType) -> @out TemplatedConstructor
6666
// CHECK-LABEL: end sil function '$s4main20templatedConstructoryyF'
6767

68-
// CHECK-LABEL: sil hidden_external [clang TemplatedConstructor.init] @{{_ZN20TemplatedConstructorC1I7ArgTypeEET_|\?\?\$\?0UArgType@@@TemplatedConstructor@@QEAA@UArgType@@@Z}} : $@convention(c) (ArgType) -> @out TemplatedConstructor
68+
// CHECK-LABEL: sil [clang TemplatedConstructor.init] @{{_ZN20TemplatedConstructorC1I7ArgTypeEET_|\?\?\$\?0UArgType@@@TemplatedConstructor@@QEAA@UArgType@@@Z}} : $@convention(c) (ArgType) -> @out TemplatedConstructor
6969
public func templatedConstructor() {
7070
let templated = TemplatedConstructor(ArgType())
7171
}

test/Interop/Cxx/templates/defaulted-template-type-parameter-module-interface.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// CHECK: func defaultedTemplateTypeParamAndUnrealtedParam(_: Int32)
1515
// CHECK: func overloadedDefaultedTemplate<T>(_: T)
1616
// CHECK: func overloadedDefaultedTemplate(_: Int32)
17-
// CHECK: func defaultedTemplateReferenceTypeParam<T>(_ t: UnsafeMutablePointer<T>)
17+
// CHECK: func defaultedTemplateReferenceTypeParam<T>(_ t: inout T)
1818
// The following types aren't imported correctly, but that does not have to do
1919
// with the fact that the template type paramaters are defaulted.
2020
// CHECK: func defaultedTemplatePointerTypeParam<T>(_ t: UnsafeMutablePointer<T>)

test/Interop/Cxx/templates/function-template-irgen-objc.swift

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/Interop/Cxx/templates/function-template-module-interface.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
// CHECK: mutating func test2(_: Int32, _ varargs: Any...)
1515
// CHECK: }
1616

17-
// CHECK: func lvalueReference<T>(_ ref: UnsafeMutablePointer<T>)
18-
// CHECK: func constLvalueReference<T>(_: UnsafePointer<T>)
19-
// CHECK: func forwardingReference<T>(_: UnsafeMutablePointer<T>)
17+
// CHECK: func lvalueReference<T>(_ ref: inout T)
18+
// CHECK: func constLvalueReference<T>(_: inout T)
19+
// CHECK: func forwardingReference<T>(_: inout T)
2020
// CHECK: func PointerTemplateParameter<T>(_: UnsafeMutablePointer<T>)
2121

2222
// CHECK: enum Orbiters {
2323
// CHECK: static func galileo<T>(_: T)
2424
// CHECK: static func cassini<T, U>(_: T, _: U)
25-
// CHECK: static func magellan<T>(_: UnsafeMutablePointer<T>)
25+
// CHECK: static func magellan<T>(_: inout T)
2626
// CHECK: }

test/Interop/Cxx/templates/function-template.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ FunctionTemplateTestSuite.test("lvalueReference<T> where T == Int") {
2828
expectEqual(value, 42)
2929
}
3030

31-
// TODO: currently "Any" is imported as an Objective-C "id".
32-
// This doesn't work without the Objective-C runtime.
33-
#if _runtime(_ObjC)
34-
FunctionTemplateTestSuite.test("passThrough<T> where T == Any") {
35-
let result = passThrough(42 as Any)
36-
expectEqual(42, result as! Int)
37-
}
38-
#endif
39-
4031
// TODO: Generics, Any, and Protocols should be tested here but need to be
4132
// better supported in ClangTypeConverter first.
4233

test/Interop/Cxx/templates/member-templates-module-interface.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// CHECK: mutating func passThroughConst<T>(_ val: T) -> T
99
// CHECK: func passThroughOnConst<T>(_ val: T) -> T
1010
// CHECK: func passThroughConstOnConst<T>(_ val: T) -> T
11-
// CHECK: mutating func doNothingConstRef<T>(_ val: UnsafePointer<T>)
12-
// CHECK: mutating func make42Ref<T>(_ val: UnsafeMutablePointer<T>)
11+
// CHECK: mutating func doNothingConstRef<T>(_ val: inout T)
12+
// CHECK: mutating func make42Ref<T>(_ val: inout T)
1313
// CHECK: }
1414

1515
// CHECK: struct __CxxTemplateInst32TemplateClassWithMemberTemplatesIiE {
@@ -24,5 +24,5 @@
2424
// CHECK: init()
2525
// CHECK: static func add<T>(_ a: T, _ b: T) -> T
2626
// CHECK: static func addTwoTemplates<T, U>(_ a: T, _ b: U) -> T
27-
// CHECK: static func removeReference<T>(_ a: UnsafeMutablePointer<T>) -> T
27+
// CHECK: static func removeReference<T>(_ a: inout T) -> T
2828
// CHECK: }

test/Interop/Cxx/templates/member-templates-silgen.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import MemberTemplates
1010
// CHECK: [[ADD:%.*]] = function_ref @_ZN18HasMemberTemplates17addSameTypeParamsIiEET_S1_S1_ : $@convention(cxx_method) (Int32, Int32, @inout HasMemberTemplates) -> Int32
1111
// CHECK: apply [[ADD]]({{.*}}) : $@convention(cxx_method) (Int32, Int32, @inout HasMemberTemplates) -> Int32
1212

13-
// CHECK: [[ADD_TWO_TEMPLATES:%.*]] = function_ref @_ZN18HasMemberTemplates18addMixedTypeParamsIiiEET_S1_T0_ : $@convention(cxx_method) (Int32, Int32, @inout HasMemberTemplates) -> Int32 // user: %26
13+
// CHECK: [[ADD_TWO_TEMPLATES:%.*]] = function_ref @_ZN18HasMemberTemplates18addMixedTypeParamsIiiEET_S1_T0_ : $@convention(cxx_method) (Int32, Int32, @inout HasMemberTemplates) -> Int32
1414
// CHECK: apply [[ADD_TWO_TEMPLATES]]({{.*}}) : $@convention(cxx_method) (Int32, Int32, @inout HasMemberTemplates) -> Int32
1515

16-
// CHECK: [[ADD_ALL:%.*]] = function_ref @_ZN18HasMemberTemplates6addAllIiiEEiiT_T0_ : $@convention(cxx_method) (Int32, Int32, Int32, @inout HasMemberTemplates) -> Int32 // user: %39
16+
// CHECK: [[ADD_ALL:%.*]] = function_ref @_ZN18HasMemberTemplates6addAllIiiEEiiT_T0_ : $@convention(cxx_method) (Int32, Int32, Int32, @inout HasMemberTemplates) -> Int32
1717
// CHECK: apply [[ADD_ALL]]({{.*}}) : $@convention(cxx_method) (Int32, Int32, Int32, @inout HasMemberTemplates) -> Int32
1818

19-
// CHECK: [[DO_NOTHING:%.*]] = function_ref @_ZN18HasMemberTemplates17doNothingConstRefIiEEvRKT_ : $@convention(cxx_method) (UnsafePointer<Int32>, @inout HasMemberTemplates) -> () // user: %48
20-
// CHECK: apply [[DO_NOTHING]]({{.*}}) : $@convention(cxx_method) (UnsafePointer<Int32>, @inout HasMemberTemplates) -> ()
19+
// CHECK: [[DO_NOTHING:%.*]] = function_ref @_ZN18HasMemberTemplates17doNothingConstRefIiEEvRKT_ : $@convention(cxx_method) (@inout Int32, @inout HasMemberTemplates) -> ()
20+
// CHECK: apply [[DO_NOTHING]]({{.*}}) : $@convention(cxx_method) (@inout Int32, @inout HasMemberTemplates) -> ()
2121

2222
// CHECK-LABEL: end sil function '$s4main9basicTestyyF'
2323
func basicTest() {
@@ -29,13 +29,13 @@ func basicTest() {
2929
obj.doNothingConstRef(&i)
3030
}
3131

32-
// CHECK-LABEL: sil hidden_external [clang HasMemberTemplates._ZN18HasMemberTemplates17addSameTypeParamsIiEET_S1_S1_] @_ZN18HasMemberTemplates17addSameTypeParamsIiEET_S1_S1_ : $@convention(cxx_method) (Int32, Int32, @inout HasMemberTemplates) -> Int32
32+
// CHECK-LABEL: sil [clang HasMemberTemplates.addSameTypeParams] @_ZN18HasMemberTemplates17addSameTypeParamsIiEET_S1_S1_ : $@convention(cxx_method) (Int32, Int32, @inout HasMemberTemplates) -> Int32
3333

34-
// CHECK-LABEL: sil hidden_external [clang HasMemberTemplates._ZN18HasMemberTemplates18addMixedTypeParamsIiiEET_S1_T0_] @_ZN18HasMemberTemplates18addMixedTypeParamsIiiEET_S1_T0_ : $@convention(cxx_method) (Int32, Int32, @inout HasMemberTemplates) -> Int32
34+
// CHECK-LABEL: sil [clang HasMemberTemplates.addMixedTypeParams] @_ZN18HasMemberTemplates18addMixedTypeParamsIiiEET_S1_T0_ : $@convention(cxx_method) (Int32, Int32, @inout HasMemberTemplates) -> Int32
3535

36-
// CHECK-LABEL: sil hidden_external [clang HasMemberTemplates._ZN18HasMemberTemplates6addAllIiiEEiiT_T0_] @_ZN18HasMemberTemplates6addAllIiiEEiiT_T0_ : $@convention(cxx_method) (Int32, Int32, Int32, @inout HasMemberTemplates) -> Int32
36+
// CHECK-LABEL: sil [clang HasMemberTemplates.addAll] @_ZN18HasMemberTemplates6addAllIiiEEiiT_T0_ : $@convention(cxx_method) (Int32, Int32, Int32, @inout HasMemberTemplates) -> Int32
3737

38-
// CHECK-LABEL: sil hidden_external [clang HasMemberTemplates._ZN18HasMemberTemplates17doNothingConstRefIiEEvRKT_] @_ZN18HasMemberTemplates17doNothingConstRefIiEEvRKT_ : $@convention(cxx_method) (UnsafePointer<Int32>, @inout HasMemberTemplates) -> ()
38+
// CHECK-LABEL: sil [clang HasMemberTemplates.doNothingConstRef] @_ZN18HasMemberTemplates17doNothingConstRefIiEEvRKT_ : $@convention(cxx_method) (@inout Int32, @inout HasMemberTemplates) -> ()
3939

4040
// CHECK-LABEL: sil hidden @$s4main12testSetValueyyF : $@convention(thin) () -> ()
4141

@@ -56,8 +56,8 @@ func testSetValue() {
5656
// CHECK: [[ADD_TWO_TEMPLATES_FN:%.*]] = function_ref @_ZN24HasStaticMemberTemplates15addTwoTemplatesIlcEET_S1_T0_ : $@convention(c) (Int, Int8) -> Int
5757
// CHECK: apply [[ADD_TWO_TEMPLATES_FN]]({{.*}}) : $@convention(c) (Int, Int8) -> Int
5858

59-
// CHECK: [[REMOVE_REFERENCE_FN:%.*]] = function_ref @_ZN24HasStaticMemberTemplates15removeReferenceIlEET_RS1_ : $@convention(c) (UnsafeMutablePointer<Int>) -> Int
60-
// CHECK: apply [[REMOVE_REFERENCE_FN]]({{.*}}) : $@convention(c) (UnsafeMutablePointer<Int>) -> Int
59+
// CHECK: [[REMOVE_REFERENCE_FN:%.*]] = function_ref @_ZN24HasStaticMemberTemplates15removeReferenceIlEET_RS1_ : $@convention(c) (@inout Int) -> Int
60+
// CHECK: apply [[REMOVE_REFERENCE_FN]]({{.*}}) : $@convention(c) (@inout Int) -> Int
6161

6262
// CHECK-LABEL: end sil function '$s4main17testStaticMembersyyF'
6363
func testStaticMembers() {
@@ -68,8 +68,8 @@ func testStaticMembers() {
6868
HasStaticMemberTemplates.removeReference(&x)
6969
}
7070

71-
// CHECK: sil hidden_external [clang HasStaticMemberTemplates._ZN24HasStaticMemberTemplates3addIlEET_S1_S1_] @_ZN24HasStaticMemberTemplates3addIlEET_S1_S1_ : $@convention(c) (Int, Int) -> Int
71+
// CHECK: sil [clang HasStaticMemberTemplates.add] @_ZN24HasStaticMemberTemplates3addIlEET_S1_S1_ : $@convention(c) (Int, Int) -> Int
7272

73-
// CHECK: sil hidden_external [clang HasStaticMemberTemplates._ZN24HasStaticMemberTemplates15addTwoTemplatesIlcEET_S1_T0_] @_ZN24HasStaticMemberTemplates15addTwoTemplatesIlcEET_S1_T0_ : $@convention(c) (Int, Int8) -> Int
73+
// CHECK: sil [clang HasStaticMemberTemplates.addTwoTemplates] @_ZN24HasStaticMemberTemplates15addTwoTemplatesIlcEET_S1_T0_ : $@convention(c) (Int, Int8) -> Int
7474

75-
// CHECK: sil hidden_external [clang HasStaticMemberTemplates._ZN24HasStaticMemberTemplates15removeReferenceIlEET_RS1_] @_ZN24HasStaticMemberTemplates15removeReferenceIlEET_RS1_ : $@convention(c) (UnsafeMutablePointer<Int>) -> Int
75+
// CHECK: sil [clang HasStaticMemberTemplates.removeReference] @_ZN24HasStaticMemberTemplates15removeReferenceIlEET_RS1_ : $@convention(c) (@inout Int) -> Int

0 commit comments

Comments
 (0)