Merge remote-tracking branch 'origin/master' into master-next

This commit is contained in:
swift-ci
2018-07-26 09:09:12 -07:00
16 changed files with 121 additions and 126 deletions

View File

@@ -4796,9 +4796,33 @@ static void collectInterestingNestedDeclarations(
const NominalTypeDecl *nominalParent = nullptr;
for (const Decl *member : members) {
// If there is a corresponding Objective-C method, record it.
auto recordObjCMethod = [&] {
if (isLocal)
return;
if (auto func = dyn_cast<AbstractFunctionDecl>(member)) {
if (func->isObjC()) {
if (auto owningClass =
func->getDeclContext()->getAsClassOrClassExtensionContext()) {
Mangle::ASTMangler mangler;
std::string ownerName = mangler.mangleNominalType(owningClass);
assert(!ownerName.empty() && "Mangled type came back empty!");
objcMethods[func->getObjCSelector()].push_back(
std::make_tuple(ownerName,
func->isObjCInstanceMethod(),
S.addDeclRef(func)));
}
}
}
};
if (auto memberValue = dyn_cast<ValueDecl>(member)) {
if (!memberValue->hasName())
if (!memberValue->hasName()) {
recordObjCMethod();
continue;
}
if (memberValue->isOperator()) {
// Add operator methods.
@@ -4834,23 +4858,7 @@ static void collectInterestingNestedDeclarations(
}
// Record Objective-C methods.
if (!isLocal) {
if (auto func = dyn_cast<AbstractFunctionDecl>(member)) {
if (func->isObjC()) {
if (auto owningClass =
func->getDeclContext()->getAsClassOrClassExtensionContext()) {
Mangle::ASTMangler mangler;
std::string ownerName = mangler.mangleNominalType(owningClass);
assert(!ownerName.empty() && "Mangled type came back empty!");
objcMethods[func->getObjCSelector()].push_back(
std::make_tuple(ownerName,
func->isObjCInstanceMethod(),
S.addDeclRef(func)));
}
}
}
}
recordObjCMethod();
}
}