mirror of
https://github.com/yuzu-emu/sirit.git
synced 2024-11-26 05:05:47 +01:00
Resolve leaks moving from Add to Sink
This commit is contained in:
parent
951ef21f17
commit
f581df0935
@ -14,7 +14,7 @@ Ref Module::Decorate(Ref target, spv::Decoration decoration,
|
|||||||
auto const op{new Op(spv::Op::OpDecorate)};
|
auto const op{new Op(spv::Op::OpDecorate)};
|
||||||
op->Add(target);
|
op->Add(target);
|
||||||
AddEnum(op, decoration);
|
AddEnum(op, decoration);
|
||||||
op->Add(literals);
|
op->Sink(literals);
|
||||||
return AddAnnotation(op);
|
return AddAnnotation(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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));
|
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(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) {
|
void Op::Add(const std::vector<Ref>& ids) {
|
||||||
for (Ref op : 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 Op::WordCount() const {
|
||||||
u16 count{1};
|
u16 count{1};
|
||||||
if (result_type) {
|
if (result_type) {
|
||||||
|
4
src/op.h
4
src/op.h
@ -29,6 +29,8 @@ class Op : public Operand {
|
|||||||
|
|
||||||
void Sink(Operand* operand);
|
void Sink(Operand* operand);
|
||||||
|
|
||||||
|
void Sink(const std::vector<Operand*>& operands);
|
||||||
|
|
||||||
void Add(const Operand* operand);
|
void Add(const Operand* operand);
|
||||||
|
|
||||||
void Add(u32 integer);
|
void Add(u32 integer);
|
||||||
@ -37,8 +39,6 @@ class Op : public Operand {
|
|||||||
|
|
||||||
void Add(const std::vector<Ref>& ids);
|
void Add(const std::vector<Ref>& ids);
|
||||||
|
|
||||||
void Add(const std::vector<Operand*>& operands);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u16 WordCount() const;
|
u16 WordCount() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user