Skip to content

[Sema] NFC: Reorder misc bits for better code gen #16690

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
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: 5 additions & 4 deletions lib/Sema/MiscDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,15 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
// Selector for the partial_application_of_function_invalid diagnostic
// message.
struct PartialApplication {
unsigned level : 29;
enum : unsigned {
Function,
MutatingMethod,
SuperInit,
SelfInit,
};
// 'kind' before 'level' is better for code gen.
unsigned kind : 3;
unsigned level : 29;
};

// Partial applications of functions that are not permitted. This is
Expand Down Expand Up @@ -121,7 +122,7 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,

// Partial applications of delegated initializers aren't allowed, and
// don't really make sense to begin with.
InvalidPartialApplications.insert({ expr, {1, kind} });
InvalidPartialApplications.insert({ expr, {kind, 1} });
return;
}

Expand All @@ -141,7 +142,7 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
if (!expr->getArg()->getType()->isMaterializable()) {
// We need to apply all argument clauses.
InvalidPartialApplications.insert({
fnExpr, {fn->getNumParameterLists(), kind}
fnExpr, {kind, fn->getNumParameterLists()}
});
}
}
Expand Down Expand Up @@ -172,7 +173,7 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
InvalidPartialApplications.erase(foundApplication);
if (level > 1) {
// We have remaining argument clauses.
InvalidPartialApplications.insert({ AE, {level - 1, kind} });
InvalidPartialApplications.insert({ AE, {kind, level - 1} });
}
return;
}
Expand Down