8000 lifetimebound compile attribute · Issue #20493 · bitcoin/bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
lifetimebound compile attribute #20493
Closed
Closed
@maflcko

Description

@maflcko

(copied from #19387 (comment) ):

There are a lot more cases in the codebase where a data type stores a reference or pointer to another object provided to the constructor exist. For example:

  • In src/stream.h: OverrideStream, CVectorReader, BitStreamReader, BitStreamWriter
  • In src/script/sign.h: MutableTransactionSignatureCreator (refactor: Change * to & in MutableTransactionSignatureCreator #19426).
  • In src/script/interpreter.h: GenericTransactionSignatureChecker
  • In src/serialize.h: Wrapper, Using
  • In src/wallet/rpcwallet.cpp: DescribeWalletAddressVisitor
  • In src/key_io.cpp: DestinationEncoder
  • In src/dbwrapper.h: CDBBatch, CDBIterator
  • In src/flatfile.h: FlatFileSeq
  • In src/hash.h: CHashVerifier
  • In src/miner.h: CBlockAssembler
  • In src/net_processing.h: PeerLogicValidation
  • In src/scheduler.h: SingleThreadedSchedulerClient (refactor: Pass lifetimebound reference to SingleThreadedSchedulerClient #25040)
  • In src/sync.h: CSemaphoreGrant
  • In src/validation.h: CScriptCheck, ChainstateManager, CChainState

Several of these accept const lvalue references, and store them, and are at risk already. Others take in a mutable lvalue reference or pointers, but would make sense to support rvalue/universal references as input (so that temporaries can be passed to it). In all those cases, having a lifetimebound attribute would be useful.

So I think that means we should just put it in attributes.h. There is plenty of potential for it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0