Skip to content

Commit ee58999

Browse files
committed
Stash: waiting on tests, etc.
1 parent f8bf74b commit ee58999

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/SIL/IR/SILFunctionType.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3109,15 +3109,19 @@ static CanSILFunctionType getSILFunctionTypeForClangDecl(
31093109
}
31103110

31113111
if (auto method = dyn_cast<clang::CXXMethodDecl>(clangDecl)) {
3112-
AbstractionPattern origPattern = AbstractionPattern::getCXXMethod(origType, method,
3113-
foreignInfo.self);
3114-
bool isMutating =
3115-
TC.Context.getClangModuleLoader()->isCXXMethodMutating(method);
3116-
auto conventions = CXXMethodConventions(method, isMutating);
3117-
return getSILFunctionType(TC, TypeExpansionContext::minimal(), origPattern,
3118-
substInterfaceType, extInfoBuilder, conventions,
3119-
foreignInfo, constant, constant, None,
3120-
ProtocolConformanceRef());
3112+
// Static methods and ctors should be lowered like plane functions
3113+
// (case below).
3114+
if (!isa<clang::CXXConstructorDecl>(method) || method->isStatic()) {
3115+
AbstractionPattern origPattern = AbstractionPattern::getCXXMethod(origType, method,
3116+
foreignInfo.self);
3117+
bool isMutating =
3118+
TC.Context.getClangModuleLoader()->isCXXMethodMutating(method);
3119+
auto conventions = CXXMethodConventions(method, isMutating);
3120+
return getSILFunctionType(TC, TypeExpansionContext::minimal(), origPattern,
3121+
substInterfaceType, extInfoBuilder, conventions,
3122+
foreignInfo, constant, constant, None,
3123+
ProtocolConformanceRef());
3124+
}
31213125
}
31223126

31233127
if (auto func = dyn_cast<clang::FunctionDecl>(clangDecl)) {

0 commit comments

Comments
 (0)