This is an archive of the discontinued LLVM Phabricator instance.

Fix DynamicRegisterInfo copying/moving issue
ClosedPublic

Authored by tatyana-krasnukha on Jun 4 2018, 10:20 AM.

Details

Summary

Default copy/move constructors and assignment operators work incorrectly, leaving wrong m_sets[i].registers pointers.

Made the class movable and non-copyable (it's difficult to imagine when it needs to be copied).

Diff Detail

Repository
rL LLVM

Event Timeline

Only question is do we need the extra "struct Data"?

source/Plugins/Process/Utility/DynamicRegisterInfo.h
99 ↗(On Diff #149801)

Is this struct necessary? Would be nice if we didn't have this extra layer?

Hello Greg,

source/Plugins/Process/Utility/DynamicRegisterInfo.h
99 ↗(On Diff #149801)

This struct helps to avoid two problems:

  1. need to modify each constructor and operator= when add or remove some data from the class - easy to forget
  2. duplication of constructor and operator code.

I hope this additional layer of abstraction is not too big price for safety.

Get rid of additional structure.
Update pointers only if finalized info is passed to the function.

clayborg accepted this revision.Jun 7 2018, 10:51 AM
This revision is now accepted and ready to land.Jun 7 2018, 10:51 AM
This revision was automatically updated to reflect the committed changes.