Page MenuHomePhabricator

Support deserializing into temporaries
ClosedPublic

Authored by markblundeberg on May 5 2019, 17:55.

Details

Summary

Backported commit 2/2 (172f5fa738) from PR12683

Original summary:
Currently, the READWRITE macro cannot be passed any non-const temporaries, as
the SerReadWrite function only accepts lvalue references.

Deserializing into a temporary is very common, however. See for example
things like 's >> VARINT(n)'. The VARINT macro produces a temporary wrapper
that holds a reference to n.

Fix this by accepting non-const rvalue references instead of lvalue references.
We don't propagate the rvalue-ness down, as there are no useful optimizations
that only apply to temporaries.

Then use this new functionality to get rid of many (but not all) uses of the
'REF' macro (which casts away constness).

Depends on D2930.

Test Plan

make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markblundeberg created this revision.May 5 2019, 17:55
Herald added a reviewer: Restricted Project. · View Herald TranscriptMay 5 2019, 17:55
markblundeberg edited the summary of this revision. (Show Details)May 7 2019, 00:39
markblundeberg added a reviewer: Fabien.
Fabien accepted this revision.May 9 2019, 07:20
This revision is now accepted and ready to land.May 9 2019, 07:20