Debug fixups

This commit is contained in:
ReinUsesLisp 2018-11-03 03:40:20 -03:00
parent 96e8290eef
commit 65ccda50c7
2 changed files with 15 additions and 2 deletions

View file

@ -201,7 +201,10 @@ class Module {
Id Name(Id target, const std::string& name);
/// Assign a Result <id> to a string for use by other debug instructions.
Id OpString(const std::string& string);
Id String(const std::string& string);
/// Add source-level location information
Id OpLine(Id file, Literal line, Literal column);
// Memory

View file

@ -19,9 +19,19 @@ Id Module::Name(Id target, const std::string& name) {
return target;
}
Id Module::OpString(const std::string& string) {
Id Module::String(const std::string& string) {
auto op{std::make_unique<Op>(spv::Op::OpString, bound++)};
op->Add(string);
const auto id = op.get();
debug.push_back(std::move(op));
return id;
}
Id Module::OpLine(Id file, Literal line, Literal column) {
auto op{std::make_unique<Op>(spv::Op::OpLine)};
op->Add(file);
op->Add(line);
op->Add(column);
return AddCode(std::move(op));
}