Improves diagnostic messages by collecting names of IDs
| 577 | |
| 578 | // Improves diagnostic messages by collecting names of IDs |
| 579 | void ValidationState_t::RegisterDebugInstruction(const Instruction* inst) { |
| 580 | switch (inst->opcode()) { |
| 581 | case spv::Op::OpName: { |
| 582 | const auto target = inst->GetOperandAs<uint32_t>(0); |
| 583 | const std::string str = inst->GetOperandAs<std::string>(1); |
| 584 | AssignNameToId(target, str); |
| 585 | break; |
| 586 | } |
| 587 | case spv::Op::OpMemberName: { |
| 588 | const auto target = inst->GetOperandAs<uint32_t>(0); |
| 589 | const std::string str = inst->GetOperandAs<std::string>(2); |
| 590 | AssignNameToId(target, str); |
| 591 | break; |
| 592 | } |
| 593 | case spv::Op::OpSourceContinued: |
| 594 | case spv::Op::OpSource: |
| 595 | case spv::Op::OpSourceExtension: |
| 596 | case spv::Op::OpString: |
| 597 | case spv::Op::OpLine: |
| 598 | case spv::Op::OpNoLine: |
| 599 | default: |
| 600 | break; |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | void ValidationState_t::RegisterInstruction(Instruction* inst) { |
| 605 | if (inst->id()) all_definitions_.insert(std::make_pair(inst->id(), inst)); |
no test coverage detected