Record Objective-C method lookup tables in Swift modules.

Include a mapping from Objective-C selectors to the @objc methods that
produce Objective-c methods with those selectors. Use this to lazily
populate the Objective-C method lookup tables in each class. This makes
@objc override checking work across Swift modules, which is part of
rdar://problem/18391046.

Note that we use a single, unified selector table, both because it is
simpler and because it makes global queries ("is there any method with
the given selector?") easier.

Swift SVN r23214
This commit is contained in:
Doug Gregor
2014-11-11 00:19:03 +00:00
parent 3910c25da1
commit b27e88b70b
16 changed files with 426 additions and 18 deletions

View File

@@ -340,6 +340,20 @@ void SerializedModuleLoader::loadExtensions(NominalTypeDecl *nominal,
}
}
void SerializedModuleLoader::loadObjCMethods(
ClassDecl *classDecl,
ObjCSelector selector,
bool isInstanceMethod,
unsigned previousGeneration,
llvm::TinyPtrVector<AbstractFunctionDecl *> &methods) {
for (auto &modulePair : LoadedModuleFiles) {
if (modulePair.second <= previousGeneration)
continue;
modulePair.first->loadObjCMethods(classDecl, selector, isInstanceMethod,
methods);
}
}
bool SerializedModuleLoader::isSerializedAST(StringRef data) {
using serialization::MODULE_SIGNATURE;
StringRef signatureStr(reinterpret_cast<const char *>(MODULE_SIGNATURE),