aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/sirit/sirit.h3
-rw-r--r--src/insts/debug.cpp3
-rw-r--r--tests/main.cpp5
3 files changed, 6 insertions, 5 deletions
diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h
index 7a5b265..728a4b7 100644
--- a/include/sirit/sirit.h
+++ b/include/sirit/sirit.h
@@ -177,7 +177,8 @@ public:
// Debug
/// Assign a name string to a reference.
- void Name(Ref target, const std::string& name);
+ /// @return target
+ Ref Name(Ref target, const std::string& name);
// Literals
static Operand* Literal(std::uint32_t value);
diff --git a/src/insts/debug.cpp b/src/insts/debug.cpp
index e12b61c..5e7ea0f 100644
--- a/src/insts/debug.cpp
+++ b/src/insts/debug.cpp
@@ -9,11 +9,12 @@
namespace Sirit {
-void Module::Name(Ref target, const std::string& name) {
+Ref Module::Name(Ref target, const std::string& name) {
Op* op{new Op(spv::Op::OpName)};
op->Add(target);
op->Add(name);
debug.push_back(std::unique_ptr<Op>(op));
+ return target;
}
} // namespace Sirit
diff --git a/tests/main.cpp b/tests/main.cpp
index f7542c0..03fee83 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -51,9 +51,8 @@ public:
Constant(TypeFloat(32), Literal(50.0f))});
ConstantNull(TypeVector(TypeInt(64, false), 4));
- auto cont{Label()};
- auto skip{Label()};
- Name(skip, "skip");
+ auto cont{Name(Label(), "cont")};
+ auto skip{Name(Label(), "skip")};
auto main_type{TypeFunction(TypeVoid())};
auto main_func{Emit(Function(TypeVoid(), spv::FunctionControlMask::MaskNone, main_type))};
Emit(Label());