[Import as memory] SILGen for delegation to a C function imported as an initializer.

Always statically dispatch to C functions imported as members, and
call to the foreign entry point. This gets us through SILGen, but DI
is still deeply unhappy with the resulting SIL.
This commit is contained in:
Doug Gregor
2016-04-05 22:25:47 -07:00
parent a02573e088
commit ab8253cfde
3 changed files with 41 additions and 9 deletions

View File

@@ -35,6 +35,10 @@ swift::getMethodDispatch(AbstractFunctionDecl *method) {
if (method->hasForcedStaticDispatch())
return MethodDispatch::Static;
// Import-as-member declarations are always statically referenced.
if (method->isImportAsMember())
return MethodDispatch::Static;
// If this declaration is in a class but not marked final, then it is
// always dynamically dispatched.
auto dc = method->getDeclContext();