From 1cd11815db4e9f3e177ae5a776c1224636a7b544 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 3 Nov 2018 21:29:24 -0300 Subject: [PATCH] Add OpMemberName --- include/sirit/sirit.h | 4 ++++ src/insts/debug.cpp | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 0003860..8fdd217 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -200,6 +200,10 @@ class Module { /// @return target Id Name(Id target, const std::string& name); + /// Assign a name string to a member of a structure type. + /// @return type + Id MemberName(Id type, std::uint32_t member, const std::string& name); + /// Assign a Result to a string for use by other debug instructions. Id String(const std::string& string); diff --git a/src/insts/debug.cpp b/src/insts/debug.cpp index d61dec1..0712d14 100644 --- a/src/insts/debug.cpp +++ b/src/insts/debug.cpp @@ -19,6 +19,15 @@ Id Module::Name(Id target, const std::string& name) { return target; } +Id Module::MemberName(Id type, u32 member, const std::string& name) { + auto op{std::make_unique(spv::Op::OpMemberName)}; + op->Add(type); + op->Add(member); + op->Add(name); + debug.push_back(std::move(op)); + return type; +} + Id Module::String(const std::string& string) { auto op{std::make_unique(spv::Op::OpString, bound++)}; op->Add(string);