Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions xls/ir/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ inline std::ostream& operator<<(std::ostream& os, ValueKind kind) {
// some discussion around this, maybe they should be?
class Value {
public:
Value() : kind_(ValueKind::kInvalid), payload_(nullptr) {}
Value& operator=(const Value&) = default;
Value& operator=(Value&& v) {
kind_ = v.kind_;
payload_ = std::move(v.payload_);
v.kind_ = ValueKind::kInvalid;
v.payload_ = nullptr;
return *this;
}
Value(const Value&) = default;
Value(Value&& v) : kind_(v.kind_), payload_(std::move(v.payload_)) {
v.kind_ = ValueKind::kInvalid;
v.payload_ = nullptr;
}

static Value Tuple(absl::Span<const Value> elements) {
return Value(ValueKind::kTuple, elements);
}
Expand Down Expand Up @@ -115,8 +130,6 @@ class Value {
UBits(/*value=*/static_cast<uint64_t>(enabled), /*bit_count=*/1));
}

Value() : kind_(ValueKind::kInvalid), payload_(nullptr) {}

explicit Value(Bits bits)
: kind_(ValueKind::kBits), payload_(std::move(bits)) {}

Expand Down
Loading