[MLIR][Bytecode] Use consistent types for resolveEntry (#171502)

uint64_t and size_t are not the same across all platforms. This was
causing build failures when building this file for wasm:

llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1323:19: error:
out-of-line definition of 'resolveEntry' does not match any declaration
in '(anonymous namespace)::AttrTypeReader'
1323 | T AttrTypeReader::resolveEntry(SmallVectorImpl<Entry<T>>
&entries, size_t index,
      |                   ^~~~~~~~~~~~

third_party/llvm/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:851:7:
note: AttrTypeReader defined here
  851 | class AttrTypeReader {
      |       ^~~~~~~~~~~~~~
1 error generated.

Use uint64_t everywhere to ensure portability.
This commit is contained in:
Aiden Grossman 2025-12-09 13:09:19 -08:00 committed by GitHub
parent 87bf5ee238
commit 8f3c8dabc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1320,8 +1320,9 @@ LogicalResult AttrTypeReader::initialize(
}
template <typename T>
T AttrTypeReader::resolveEntry(SmallVectorImpl<Entry<T>> &entries, size_t index,
StringRef entryType, uint64_t depth) {
T AttrTypeReader::resolveEntry(SmallVectorImpl<Entry<T>> &entries,
uint64_t index, StringRef entryType,
uint64_t depth) {
if (index >= entries.size()) {
emitError(fileLoc) << "invalid " << entryType << " index: " << index;
return {};