Returns SPV_SUCCESS if validation rules are satisfied for the Block decoration. Otherwise emits a diagnostic and returns something other than SPV_SUCCESS.
| 2112 | // decoration. Otherwise emits a diagnostic and returns something other than |
| 2113 | // SPV_SUCCESS. |
| 2114 | spv_result_t CheckBlockDecoration(ValidationState_t& vstate, |
| 2115 | const Instruction& inst, |
| 2116 | const Decoration& decoration) { |
| 2117 | assert(inst.id() && "Parser ensures the target of the decoration has an ID"); |
| 2118 | if (inst.opcode() != spv::Op::OpTypeStruct) { |
| 2119 | const char* const dec_name = decoration.dec_type() == spv::Decoration::Block |
| 2120 | ? "Block" |
| 2121 | : "BufferBlock"; |
| 2122 | return vstate.diag(SPV_ERROR_INVALID_ID, &inst) |
| 2123 | << dec_name << " decoration on a non-struct type."; |
| 2124 | } |
| 2125 | return SPV_SUCCESS; |
| 2126 | } |
| 2127 | |
| 2128 | spv_result_t CheckLocationDecoration(ValidationState_t& vstate, |
| 2129 | const Instruction& inst, |
no test coverage detected