mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/master' into master-next
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user