summaryrefslogtreecommitdiff
path: root/kernel/yosys.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/yosys.h')
-rw-r--r--kernel/yosys.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/yosys.h b/kernel/yosys.h
index db8161c5..14277ade 100644
--- a/kernel/yosys.h
+++ b/kernel/yosys.h
@@ -140,6 +140,17 @@ using std::vector;
using std::string;
using std::pair;
+// A primitive shared string implementation that does not
+// move its .c_str() when the object is copied or moved.
+struct shared_str {
+ std::shared_ptr<string> content;
+ shared_str() { }
+ shared_str(string s) { content = std::shared_ptr<string>(new string(s)); }
+ shared_str(const char *s) { content = std::shared_ptr<string>(new string(s)); }
+ const char *c_str() { return content->c_str(); }
+ const string &str() { return *content; }
+};
+
using hashlib::mkhash;
using hashlib::mkhash_init;
using hashlib::mkhash_add;