mirror of
https://github.com/YosysHQ/yosys
synced 2025-11-05 22:06:04 +00:00
Create RTLIL::OwningIdString and use it in a few places
This commit is contained in:
parent
2ca7b2f7d7
commit
b3f79ed8e7
2 changed files with 13 additions and 2 deletions
|
|
@ -42,7 +42,7 @@ std::vector<uint32_t> RTLIL::IdString::global_refcount_storage_;
|
||||||
std::vector<int> RTLIL::IdString::global_free_idx_list_;
|
std::vector<int> RTLIL::IdString::global_free_idx_list_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define X(_id) const RTLIL::IdString RTLIL::IDInternal::_id(RTLIL::StaticId::_id);
|
#define X(_id) const RTLIL::OwningIdString RTLIL::IDInternal::_id(RTLIL::StaticId::_id);
|
||||||
#include "kernel/constids.inc"
|
#include "kernel/constids.inc"
|
||||||
#undef X
|
#undef X
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,7 @@ namespace RTLIL
|
||||||
struct Binding;
|
struct Binding;
|
||||||
struct IdString;
|
struct IdString;
|
||||||
struct StaticIdString;
|
struct StaticIdString;
|
||||||
|
struct OwningIdString;
|
||||||
|
|
||||||
typedef std::pair<SigSpec, SigSpec> SigSig;
|
typedef std::pair<SigSpec, SigSpec> SigSig;
|
||||||
|
|
||||||
|
|
@ -459,6 +460,16 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RTLIL::OwningIdString : public RTLIL::IdString {
|
||||||
|
inline OwningIdString() { }
|
||||||
|
inline OwningIdString(const char *str) : IdString(str) { }
|
||||||
|
inline OwningIdString(const IdString &str) : IdString(str) { }
|
||||||
|
inline OwningIdString(IdString &&str) : IdString(str) { }
|
||||||
|
inline OwningIdString(const std::string &str) : IdString(str) { }
|
||||||
|
inline OwningIdString(std::string_view str) : IdString(str) { }
|
||||||
|
inline OwningIdString(StaticId id) : IdString(id) { }
|
||||||
|
};
|
||||||
|
|
||||||
namespace hashlib {
|
namespace hashlib {
|
||||||
template <>
|
template <>
|
||||||
struct hash_ops<RTLIL::IdString> {
|
struct hash_ops<RTLIL::IdString> {
|
||||||
|
|
@ -493,7 +504,7 @@ inline bool RTLIL::IdString::operator!=(const RTLIL::StaticIdString &rhs) const
|
||||||
|
|
||||||
namespace RTLIL {
|
namespace RTLIL {
|
||||||
namespace IDInternal {
|
namespace IDInternal {
|
||||||
#define X(_id) extern const IdString _id;
|
#define X(_id) extern const OwningIdString _id;
|
||||||
#include "kernel/constids.inc"
|
#include "kernel/constids.inc"
|
||||||
#undef X
|
#undef X
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue