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

Function ValidateDebugInfoOperand

source/val/validate_extensions.cpp:252–275  ·  view source on GitHub ↗

Check that the operand of a debug info instruction |inst| at |word_index| is a result id of an debug info instruction whose debug instruction type is |expected_debug_inst|.

Source from the content-addressed store, hash-verified

250// is a result id of an debug info instruction whose debug instruction type
251// is |expected_debug_inst|.
252spv_result_t ValidateDebugInfoOperand(
253 ValidationState_t& _, const std::string& debug_inst_name,
254 CommonDebugInfoInstructions expected_debug_inst, const Instruction* inst,
255 uint32_t word_index) {
256 std::function<bool(CommonDebugInfoInstructions)> expectation =
257 [expected_debug_inst](CommonDebugInfoInstructions dbg_inst) {
258 return dbg_inst == expected_debug_inst;
259 };
260 if (DoesDebugInfoOperandMatchExpectation(_, expectation, inst, word_index))
261 return SPV_SUCCESS;
262
263 const ExtInstDesc* desc = nullptr;
264 if (LookupExtInst(inst->ext_inst_type(), expected_debug_inst, &desc) !=
265 SPV_SUCCESS ||
266 !desc) {
267 return _.diag(SPV_ERROR_INVALID_DATA, inst)
268 << GetExtInstName(_, inst) << ": " << "expected operand "
269 << debug_inst_name << " is invalid";
270 }
271 return _.diag(SPV_ERROR_INVALID_DATA, inst)
272 << GetExtInstName(_, inst) << ": " << "expected operand "
273 << debug_inst_name << " must be a result id of "
274 << desc->name().data();
275}
276
277#define CHECK_DEBUG_OPERAND(NAME, debug_opcode, index) \
278 do { \

Callers 1

ValidateOperandBaseTypeFunction · 0.85

Calls 7

LookupExtInstFunction · 0.85
GetExtInstNameFunction · 0.85
ext_inst_typeMethod · 0.80
diagMethod · 0.80
dataMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected