| 221 | } |
| 222 | |
| 223 | LogicalResult getString(uint64_t index, StringRef &result, |
| 224 | MLIRContext &context) const { |
| 225 | if (index >= stringOffsets.size()) |
| 226 | return ::emitError(UnknownLoc::get(&context)) |
| 227 | << "string index " << index << " out of bounds"; |
| 228 | uint32_t start = stringOffsets[index]; |
| 229 | uint32_t end = (index + 1 < stringOffsets.size()) |
| 230 | ? stringOffsets[index + 1] |
| 231 | : static_cast<uint32_t>(stringData.size()); |
| 232 | result = stringData.substr(start, end - start); |
| 233 | return success(); |
| 234 | } |
| 235 | |
| 236 | /// Reads a string index and returns the corresponding StringRef. |
| 237 | LogicalResult readAndGetString(StringRef &result) { |
no test coverage detected