Check that the operand of a debug info instruction |inst| at |word_index| is a result id of an instruction with |expected_opcode|.
| 127 | // Check that the operand of a debug info instruction |inst| at |word_index| |
| 128 | // is a result id of an instruction with |expected_opcode|. |
| 129 | spv_result_t ValidateOperandForDebugInfo(ValidationState_t& _, |
| 130 | const std::string& operand_name, |
| 131 | spv::Op expected_opcode, |
| 132 | const Instruction* inst, |
| 133 | uint32_t word_index) { |
| 134 | auto* operand = _.FindDef(inst->word(word_index)); |
| 135 | if (operand->opcode() != expected_opcode) { |
| 136 | const spvtools::InstructionDesc* desc = nullptr; |
| 137 | if (spvtools::LookupOpcodeForEnv(_.context()->target_env, expected_opcode, |
| 138 | &desc) != SPV_SUCCESS || |
| 139 | !desc) { |
| 140 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 141 | << GetExtInstName(_, inst) << ": " << "expected operand " |
| 142 | << operand_name << " is invalid"; |
| 143 | } |
| 144 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 145 | << GetExtInstName(_, inst) << ": " << "expected operand " |
| 146 | << operand_name << " must be a result id of " << "Op" |
| 147 | << desc->name().data(); |
| 148 | } |
| 149 | return SPV_SUCCESS; |
| 150 | } |
| 151 | |
| 152 | // For NonSemantic.Shader.DebugInfo.100 check that the operand of a debug info |
| 153 | // instruction |inst| at |word_index| is a result id of a 32-bit integer |
nothing calls this directly
no test coverage detected