MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / extractOpString

Function extractOpString

tools/objdump/extract_source.cpp:65–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65spv_result_t extractOpString(const spv_position_t& loc,
66 const spv_parsed_instruction_t& instruction,
67 std::string* output) {
68 assert(output != nullptr);
69 assert(instruction.opcode == static_cast<unsigned>(spv::Op::OpString));
70 if (instruction.num_operands != 2) {
71 spvtools::Error(spvtools::utils::CLIMessageConsumer, "", loc,
72 "Missing operands for OpString.");
73 return SPV_ERROR_INVALID_BINARY;
74 }
75
76 const auto& operand = instruction.operands[1];
77 const char* stringBegin =
78 reinterpret_cast<const char*>(instruction.words + operand.offset);
79 const char* stringEnd = reinterpret_cast<const char*>(
80 instruction.words + operand.offset + operand.num_words);
81 return ExtractStringLiteral(loc, stringBegin, stringEnd, output);
82}
83
84spv_result_t extractOpSourceContinued(
85 const spv_position_t& loc, const spv_parsed_instruction_t& instruction,

Callers 1

ExtractSourceFromModuleFunction · 0.85

Calls 2

ExtractStringLiteralFunction · 0.85
ErrorFunction · 0.50

Tested by

no test coverage detected