This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Emit destructor calls to destruct non-trivial C struct temporaries created by conditional and assignment operators
ClosedPublic

Authored by ahatanak on Jul 8 2020, 7:30 PM.

Diff Detail

Event Timeline

ahatanak created this revision.Jul 8 2020, 7:30 PM
This revision is now accepted and ready to land.Oct 23 2020, 10:22 AM
This revision was landed with ongoing or failed builds.Oct 23 2020, 2:46 PM
This revision was automatically updated to reflect the committed changes.

Idle curiosity: The patch description says "non-trivial C struct temporaries" - can C have non-trivial structs? Or is this limited to Objective C (judging/guessing by the tests)?

C structs with ObjC pointer fields are non-trivial when ARC is enabled since construction, destruction, and copy are non-trivial (see https://reviews.llvm.org/D41228). As far as I know, this is limited to ObjC.

C structs with ObjC pointer fields are non-trivial when ARC is enabled since construction, destruction, and copy are non-trivial (see https://reviews.llvm.org/D41228). As far as I know, this is limited to ObjC.

OK, good to know - thanks for explaining!

Pointer authentication can also make structs non-trivial to copy.