Skip to content

[mlir][BytecodeReader] Const qualify *SectionReader, NFC #99376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions mlir/lib/Bytecode/Reader/BytecodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,15 @@ class StringSectionReader {

/// Parse a shared string from the string section. The shared string is
/// encoded using an index to a corresponding string in the string section.
LogicalResult parseString(EncodingReader &reader, StringRef &result) {
LogicalResult parseString(EncodingReader &reader, StringRef &result) const {
return parseEntry(reader, strings, result, "string");
}

/// Parse a shared string from the string section. The shared string is
/// encoded using an index to a corresponding string in the string section.
/// This variant parses a flag compressed with the index.
LogicalResult parseStringWithFlag(EncodingReader &reader, StringRef &result,
bool &flag) {
bool &flag) const {
uint64_t entryIdx;
if (failed(reader.parseVarIntWithFlag(entryIdx, flag)))
return failure();
Expand All @@ -394,7 +394,7 @@ class StringSectionReader {
/// Parse a shared string from the string section. The shared string is
/// encoded using an index to a corresponding string in the string section.
LogicalResult parseStringAtIndex(EncodingReader &reader, uint64_t index,
StringRef &result) {
StringRef &result) const {
return resolveEntry(reader, strings, index, result, "string");
}

Expand Down Expand Up @@ -545,7 +545,7 @@ class ResourceSectionReader {

/// Parse a dialect resource handle from the resource section.
LogicalResult parseResourceHandle(EncodingReader &reader,
AsmDialectResourceHandle &result) {
AsmDialectResourceHandle &result) const {
return parseEntry(reader, dialectResources, result, "resource handle");
}

Expand Down Expand Up @@ -801,8 +801,8 @@ class AttrTypeReader {
using TypeEntry = Entry<Type>;

public:
AttrTypeReader(StringSectionReader &stringReader,
ResourceSectionReader &resourceReader,
AttrTypeReader(const StringSectionReader &stringReader,
const ResourceSectionReader &resourceReader,
const llvm::StringMap<BytecodeDialect *> &dialectsMap,
uint64_t &bytecodeVersion, Location fileLoc,
const ParserConfig &config)
Expand Down Expand Up @@ -882,11 +882,11 @@ class AttrTypeReader {

/// The string section reader used to resolve string references when parsing
/// custom encoded attribute/type entries.
StringSectionReader &stringReader;
const StringSectionReader &stringReader;

/// The resource section reader used to resolve resource references when
/// parsing custom encoded attribute/type entries.
ResourceSectionReader &resourceReader;
const ResourceSectionReader &resourceReader;

/// The map of the loaded dialects used to retrieve dialect information, such
/// as the dialect version.
Expand All @@ -909,8 +909,8 @@ class AttrTypeReader {
class DialectReader : public DialectBytecodeReader {
public:
DialectReader(AttrTypeReader &attrTypeReader,
StringSectionReader &stringReader,
ResourceSectionReader &resourceReader,
const StringSectionReader &stringReader,
const ResourceSectionReader &resourceReader,
const llvm::StringMap<BytecodeDialect *> &dialectsMap,
EncodingReader &reader, uint64_t &bytecodeVersion)
: attrTypeReader(attrTypeReader), stringReader(stringReader),
Expand Down Expand Up @@ -1043,8 +1043,8 @@ class DialectReader : public DialectBytecodeReader {

private:
AttrTypeReader &attrTypeReader;
StringSectionReader &stringReader;
ResourceSectionReader &resourceReader;
const StringSectionReader &stringReader;
const ResourceSectionReader &resourceReader;
const llvm::StringMap<BytecodeDialect *> &dialectsMap;
EncodingReader &reader;
uint64_t &bytecodeVersion;
Expand Down Expand Up @@ -1083,7 +1083,7 @@ class PropertiesSectionReader {
}

LogicalResult read(Location fileLoc, DialectReader &dialectReader,
OperationName *opName, OperationState &opState) {
OperationName *opName, OperationState &opState) const {
uint64_t propertiesIdx;
if (failed(dialectReader.readVarInt(propertiesIdx)))
return failure();
Expand Down
Loading