diff --git a/src/insts/annotation.cpp b/src/insts/annotation.cpp index 81c9c9b..ab23013 100644 --- a/src/insts/annotation.cpp +++ b/src/insts/annotation.cpp @@ -14,7 +14,7 @@ Ref Module::Decorate(Ref target, spv::Decoration decoration, auto const op{new Op(spv::Op::OpDecorate)}; op->Add(target); AddEnum(op, decoration); - op->Add(literals); + op->Sink(literals); return AddAnnotation(op); } diff --git a/src/op.cpp b/src/op.cpp index 68dbe33..a6afe51 100644 --- a/src/op.cpp +++ b/src/op.cpp @@ -65,11 +65,17 @@ void Op::Sink(Operand* operand) { operand_store.push_back(std::unique_ptr(operand)); } +void Op::Sink(const std::vector& operands) { + for (Operand* operand : operands) { + Sink(operand); + } +} + void Op::Add(const Operand* operand) { operands.push_back(operand); } -void Op::Add(u32 integer) { Add(LiteralNumber::Create(integer)); } +void Op::Add(u32 integer) { Sink(LiteralNumber::Create(integer)); } -void Op::Add(const std::string& string) { Add(new LiteralString(string)); } +void Op::Add(const std::string& string) { Sink(new LiteralString(string)); } void Op::Add(const std::vector& ids) { for (Ref op : ids) { @@ -77,12 +83,6 @@ void Op::Add(const std::vector& ids) { } } -void Op::Add(const std::vector& operands) { - for (Operand* operand : operands) { - Add(operand); - } -} - u16 Op::WordCount() const { u16 count{1}; if (result_type) { diff --git a/src/op.h b/src/op.h index 7111721..87e51c1 100644 --- a/src/op.h +++ b/src/op.h @@ -29,6 +29,8 @@ class Op : public Operand { void Sink(Operand* operand); + void Sink(const std::vector& operands); + void Add(const Operand* operand); void Add(u32 integer); @@ -37,8 +39,6 @@ class Op : public Operand { void Add(const std::vector& ids); - void Add(const std::vector& operands); - private: u16 WordCount() const;