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

Function ValidateMemberName

source/val/validate_debug.cpp:24–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace {
23
24spv_result_t ValidateMemberName(ValidationState_t& _, const Instruction* inst) {
25 const auto type_id = inst->GetOperandAs<uint32_t>(0);
26 const auto type = _.FindDef(type_id);
27 if (!type || spv::Op::OpTypeStruct != type->opcode()) {
28 return _.diag(SPV_ERROR_INVALID_ID, inst)
29 << "OpMemberName Type <id> " << _.getIdName(type_id)
30 << " is not a struct type.";
31 }
32 const auto member_id = inst->GetOperandAs<uint32_t>(1);
33 const auto member_count = (uint32_t)(type->words().size() - 2);
34 if (member_count <= member_id) {
35 return _.diag(SPV_ERROR_INVALID_ID, inst)
36 << "OpMemberName Member <id> " << _.getIdName(member_id)
37 << " index is larger than Type <id> " << _.getIdName(type->id())
38 << "s member count.";
39 }
40 return SPV_SUCCESS;
41}
42
43spv_result_t ValidateLine(ValidationState_t& _, const Instruction* inst) {
44 const auto file_id = inst->GetOperandAs<uint32_t>(0);

Callers 1

DebugPassFunction · 0.85

Calls 6

FindDefMethod · 0.80
diagMethod · 0.80
getIdNameMethod · 0.80
opcodeMethod · 0.45
sizeMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected