| 562 | } |
| 563 | |
| 564 | bool DebugInfoManager::AddDebugValueForVariable(Instruction* line, |
| 565 | uint32_t variable_id, |
| 566 | uint32_t value_id, |
| 567 | Instruction* insert_pos) { |
| 568 | assert(line != nullptr); |
| 569 | |
| 570 | auto dbg_decl_itr = var_id_to_dbg_decl_.find(variable_id); |
| 571 | if (dbg_decl_itr == var_id_to_dbg_decl_.end()) return false; |
| 572 | |
| 573 | bool modified = false; |
| 574 | for (auto* dbg_decl_or_val : dbg_decl_itr->second) { |
| 575 | // Avoid inserting the new DebugValue between OpPhi or OpVariable |
| 576 | // instructions. |
| 577 | Instruction* insert_before = insert_pos->NextNode(); |
| 578 | while (insert_before->opcode() == spv::Op::OpPhi || |
| 579 | insert_before->opcode() == spv::Op::OpVariable) { |
| 580 | insert_before = insert_before->NextNode(); |
| 581 | } |
| 582 | modified |= AddDebugValueForDecl(dbg_decl_or_val, value_id, insert_before, |
| 583 | line) != nullptr; |
| 584 | } |
| 585 | return modified; |
| 586 | } |
| 587 | |
| 588 | Instruction* DebugInfoManager::AddDebugValueForDecl(Instruction* dbg_decl, |
| 589 | uint32_t value_id, |
no test coverage detected