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
Branch
PR12683b
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5683
Build 9428: Bitcoin ABC Buildbot (legacy)
Build 9427: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.May 9 2019, 07:20