Skip to content

Sema: Fix performance regression by only checking for selector conflicts in primary files #29652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/Sema/TypeCheckAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,16 @@ void AttributeChecker::visitObjCAttr(ObjCAttr *attr) {
: diag::objc_name_deinit);
const_cast<ObjCAttr *>(attr)->clearName();
} else {
auto func = cast<AbstractFunctionDecl>(D);

// Trigger lazy loading of any imported members with the same selector.
// This ensures we correctly diagnose selector conflicts.
if (auto *CD = D->getDeclContext()->getSelfClassDecl()) {
(void) CD->lookupDirect(*objcName, !func->isStatic());
}

// We have a function. Make sure that the number of parameters
// matches the "number of colons" in the name.
auto func = cast<AbstractFunctionDecl>(D);
auto params = func->getParameters();
unsigned numParameters = params->size();
if (auto CD = dyn_cast<ConstructorDecl>(func))
Expand Down
3 changes: 0 additions & 3 deletions lib/Sema/TypeCheckDeclObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,9 +1619,6 @@ void markAsObjC(ValueDecl *D, ObjCReason reason,

// Record the method in the class, if it's a member of one.
if (auto classDecl = D->getDeclContext()->getSelfClassDecl()) {
// Trigger lazy loading of any imported members with the same selector.
(void) classDecl->lookupDirect(selector, !method->isStatic());

classDecl->recordObjCMethod(method, selector);
}

Expand Down