| 4161 | } |
| 4162 | |
| 4163 | bool HloParserImpl::AddInstruction(const std::string& name, |
| 4164 | HloInstruction* instruction, |
| 4165 | LocTy name_loc) { |
| 4166 | auto result = current_name_table().insert({name, {instruction, name_loc}}); |
| 4167 | if (!result.second) { |
| 4168 | Error(name_loc, StrCat("instruction already exists: ", name)); |
| 4169 | return Error(/*loc=*/result.first->second.second, |
| 4170 | "instruction previously defined here"); |
| 4171 | } |
| 4172 | return true; |
| 4173 | } |
| 4174 | |
| 4175 | bool HloParserImpl::AddComputation(const std::string& name, |
| 4176 | HloComputation* computation, |