3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-05-29 21:36:33 +00:00

rtlil: allow friends to use Cell constructors with a factory token pattern

This commit is contained in:
Emil J. Tywoniak 2025-12-21 16:56:14 +01:00
parent b3f605e0d2
commit 3e6b740430
3 changed files with 8 additions and 6 deletions

View file

@ -2525,18 +2525,20 @@ struct RTLIL::Memory : public RTLIL::NamedObject
struct RTLIL::Cell : public RTLIL::NamedObject
{
private:
struct ConstructToken { explicit ConstructToken() = default; };
public:
Hasher::hash_t hashidx_;
[[nodiscard]] Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; }
public:
// use module->addCell() and module->remove() to create or destroy cells
friend struct RTLIL::Module;
friend struct RTLIL::Patch;
Cell();
Cell(ConstructToken);
~Cell();
// do not simply copy cells
Cell(RTLIL::Cell &other) = delete;
Cell(ConstructToken, RTLIL::Cell &other);
void operator=(RTLIL::Cell &other) = delete;
RTLIL::Module *module;