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|.
| 250 | // is a result id of an debug info instruction whose debug instruction type |
| 251 | // is |expected_debug_inst|. |
| 252 | spv_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 { \ |
no test coverage detected