mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2025-12-25 08:46:02 +01:00
Resolve leaks moving from Add to Sink
This commit is contained in:
parent
951ef21f17
commit
f581df0935
3 changed files with 11 additions and 11 deletions
16
src/op.cpp
16
src/op.cpp
|
|
@ -65,11 +65,17 @@ void Op::Sink(Operand* operand) {
|
|||
operand_store.push_back(std::unique_ptr<Operand>(operand));
|
||||
}
|
||||
|
||||
void Op::Sink(const std::vector<Operand*>& 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<u32>(integer)); }
|
||||
void Op::Add(u32 integer) { Sink(LiteralNumber::Create<u32>(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<Ref>& ids) {
|
||||
for (Ref op : ids) {
|
||||
|
|
@ -77,12 +83,6 @@ void Op::Add(const std::vector<Ref>& ids) {
|
|||
}
|
||||
}
|
||||
|
||||
void Op::Add(const std::vector<Operand*>& operands) {
|
||||
for (Operand* operand : operands) {
|
||||
Add(operand);
|
||||
}
|
||||
}
|
||||
|
||||
u16 Op::WordCount() const {
|
||||
u16 count{1};
|
||||
if (result_type) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue