mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user