This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Make TrailingObjects non-copyable/non-movable
ClosedPublic

Authored by erichkeane on Feb 23 2021, 12:02 PM.

Details

Summary

This got me pretty recently... TrailingObjects cannot be copied or
moved, since they need to be pre-allocated. This patch deletes the copy
and move operations (plus re-adds the default ctor).

Diff Detail

Event Timeline

erichkeane created this revision.Feb 23 2021, 12:02 PM
erichkeane requested review of this revision.Feb 23 2021, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2021, 12:02 PM
jyknight accepted this revision.Feb 23 2021, 3:07 PM

I can imagine there being some cases where these could theoretically be useful.

But if you've tested this change and it doesn't cause build failures with any existing uses of TrailingObjects in llvm-project, then LGTM.

This revision is now accepted and ready to land.Feb 23 2021, 3:07 PM
This revision was landed with ongoing or failed builds.Feb 23 2021, 4:30 PM
This revision was automatically updated to reflect the committed changes.

I can imagine there being some cases where these could theoretically be useful.

But if you've tested this change and it doesn't cause build failures with any existing uses of TrailingObjects in llvm-project, then LGTM.

Thanks! I ran into the problem because I had a function that returned by reference, and stored a copy, which worked silently. Then, during runtime, I obviously got nonsense.

Hopefully these are sufficient to prevent that from being a problem for others in the future. I'd built ahead of time (and done check-all), so I'm quite confident that this won't cause issues.