mirror of
https://github.com/yuzu-emu/sirit.git
synced 2024-11-26 02:15:40 +01:00
Add asserts against nullptr operands
This commit is contained in:
parent
d24685ebd3
commit
6e14d37386
@ -4,6 +4,7 @@
|
|||||||
* 3-Clause BSD License
|
* 3-Clause BSD License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "common_types.h"
|
#include "common_types.h"
|
||||||
@ -63,6 +64,7 @@ void Op::Write(Stream& stream) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Op::Sink(Operand* operand) {
|
void Op::Sink(Operand* operand) {
|
||||||
|
assert(operand);
|
||||||
Add(static_cast<const Operand*>(operand));
|
Add(static_cast<const Operand*>(operand));
|
||||||
operand_store.push_back(std::unique_ptr<Operand>(operand));
|
operand_store.push_back(std::unique_ptr<Operand>(operand));
|
||||||
}
|
}
|
||||||
@ -103,6 +105,7 @@ void Op::Add(const std::vector<Literal>& literals) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Op::Add(const Operand* operand) {
|
void Op::Add(const Operand* operand) {
|
||||||
|
assert(operand);
|
||||||
operands.push_back(operand);
|
operands.push_back(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +118,7 @@ void Op::Add(std::string string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Op::Add(const std::vector<Id>& ids) {
|
void Op::Add(const std::vector<Id>& ids) {
|
||||||
|
assert(std::all_of(ids.begin(), ids.end(), [](auto id) { return id; }));
|
||||||
operands.insert(operands.end(), ids.begin(), ids.end());
|
operands.insert(operands.end(), ids.begin(), ids.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user