Skip to content

Commit 551809d

Browse files
authored
Merge pull request #16690 from davezarzycki/nfc_reorder_misc_partial_application_diag_bits
[Sema] NFC: Reorder misc bits for better code gen
2 parents 64ef2f5 + 7a5d968 commit 551809d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Sema/MiscDiagnostics.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,15 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
8686
// Selector for the partial_application_of_function_invalid diagnostic
8787
// message.
8888
struct PartialApplication {
89-
unsigned level : 29;
9089
enum : unsigned {
9190
Function,
9291
MutatingMethod,
9392
SuperInit,
9493
SelfInit,
9594
};
95+
// 'kind' before 'level' is better for code gen.
9696
unsigned kind : 3;
97+
unsigned level : 29;
9798
};
9899

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

122123
// Partial applications of delegated initializers aren't allowed, and
123124
// don't really make sense to begin with.
124-
InvalidPartialApplications.insert({ expr, {1, kind} });
125+
InvalidPartialApplications.insert({ expr, {kind, 1} });
125126
return;
126127
}
127128

@@ -141,7 +142,7 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
141142
if (!expr->getArg()->getType()->isMaterializable()) {
142143
// We need to apply all argument clauses.
143144
InvalidPartialApplications.insert({
144-
fnExpr, {fn->getNumParameterLists(), kind}
145+
fnExpr, {kind, fn->getNumParameterLists()}
145146
});
146147
}
147148
}
@@ -172,7 +173,7 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
172173
InvalidPartialApplications.erase(foundApplication);
173174
if (level > 1) {
174175
// We have remaining argument clauses.
175-
InvalidPartialApplications.insert({ AE, {level - 1, kind} });
176+
InvalidPartialApplications.insert({ AE, {kind, level - 1} });
176177
}
177178
return;
178179
}

0 commit comments

Comments
 (0)