| 26 | namespace { |
| 27 | |
| 28 | std::pair<int, int32_t> GetLineAndLineOffset(const SourceInfo* source_info, |
| 29 | int32_t position) { |
| 30 | int line = 0; |
| 31 | int32_t line_offset = 0; |
| 32 | if (source_info != nullptr) { |
| 33 | for (const auto& curr_line_offset : source_info->line_offsets()) { |
| 34 | if (curr_line_offset > position) { |
| 35 | break; |
| 36 | } |
| 37 | line_offset = curr_line_offset; |
| 38 | line++; |
| 39 | } |
| 40 | } |
| 41 | if (line == 0) { |
| 42 | line++; |
| 43 | } |
| 44 | return std::pair<int, int32_t>(line, line_offset); |
| 45 | } |
| 46 | |
| 47 | } // namespace |
| 48 |
no test coverage detected