AST: Mark implicit destructor as synthesized to fix non-deterministic function order

We can synthesize the default init() and the implicit deinit in a class in
any order, depending on the order of primary files and how that class was
used in other primary files.

Make sure that EmittedMembersRequest puts the destructor at the end with
all other synthesized members, so that we produce the same object file in
any case.
This commit is contained in:
Slava Pestov
2020-06-26 23:08:40 -04:00
parent 055b3a8e2e
commit 89b2f27b4d
4 changed files with 20 additions and 3 deletions

View File

@@ -4318,6 +4318,10 @@ GetDestructorRequest::evaluate(Evaluator &evaluator, ClassDecl *CD) const {
if (ctx.LangOpts.EnableObjCInterop)
CD->recordObjCMethod(DD, DD->getObjCSelector());
// Mark it as synthesized to make its location in getEmittedMembers()
// deterministic.
DD->setSynthesized(true);
return DD;
}