Gets or creates an index for a type in the type table.
| 331 | |
| 332 | // Gets or creates an index for a type in the type table. |
| 333 | uint64_t getTypeIndex(Type type) { |
| 334 | // Use the type's memory address as a unique key for lookup |
| 335 | const void *key = type.getAsOpaquePointer(); |
| 336 | auto it = typeIndexMap.find(key); |
| 337 | if (it != typeIndexMap.end()) |
| 338 | return it->second; |
| 339 | // Ensure dependent/nested types are registered before the type itself |
| 340 | registerDependentTypes(type); |
| 341 | uint64_t index = typeList.size(); |
| 342 | typeIndexMap[key] = index; |
| 343 | typeList.push_back(type); |
| 344 | return index; |
| 345 | } |
| 346 | |
| 347 | LogicalResult writeTypeSection(raw_ostream &stream) { |
| 348 | SmallVector<char> buffer; |
no test coverage detected