diff --git a/mlir/include/mlir/IR/Dialect.h b/mlir/include/mlir/IR/Dialect.h index b129395d0125..db5ba53ad535 100644 --- a/mlir/include/mlir/IR/Dialect.h +++ b/mlir/include/mlir/IR/Dialect.h @@ -78,8 +78,7 @@ public: }; /// Parse a type registered to this dialect. - virtual Type parseType(StringRef tyData, Location loc, - MLIRContext *context) const; + virtual Type parseType(StringRef tyData, Location loc) const; /// Print a type registered to this dialect. /// Note: The data printed for the provided type must not include any '"' diff --git a/mlir/include/mlir/LLVMIR/LLVMDialect.h b/mlir/include/mlir/LLVMIR/LLVMDialect.h index e07d496cefe9..61948ec076fa 100644 --- a/mlir/include/mlir/LLVMIR/LLVMDialect.h +++ b/mlir/include/mlir/LLVMIR/LLVMDialect.h @@ -73,8 +73,7 @@ public: llvm::Module &getLLVMModule() { return module; } /// Parse a type registered to this dialect. - Type parseType(StringRef tyData, Location loc, - MLIRContext *context) const override; + Type parseType(StringRef tyData, Location loc) const override; /// Print a type registered to this dialect. void printType(Type type, raw_ostream &os) const override; diff --git a/mlir/lib/IR/Dialect.cpp b/mlir/lib/IR/Dialect.cpp index d19b150fb48b..fdef9a19e67f 100644 --- a/mlir/lib/IR/Dialect.cpp +++ b/mlir/lib/IR/Dialect.cpp @@ -68,10 +68,9 @@ Dialect::Dialect(StringRef namePrefix, MLIRContext *context) Dialect::~Dialect() {} /// Parse a type registered to this dialect. -Type Dialect::parseType(StringRef tyData, Location loc, - MLIRContext *context) const { - context->emitError(loc, "dialect '" + getNamespace() + - "' provides no type parsing hook"); +Type Dialect::parseType(StringRef tyData, Location loc) const { + getContext()->emitError(loc, "dialect '" + getNamespace() + + "' provides no type parsing hook"); return Type(); } diff --git a/mlir/lib/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/LLVMIR/IR/LLVMDialect.cpp index b2e0f9751043..4e05995473c0 100644 --- a/mlir/lib/LLVMIR/IR/LLVMDialect.cpp +++ b/mlir/lib/LLVMIR/IR/LLVMDialect.cpp @@ -75,13 +75,12 @@ LLVMDialect::LLVMDialect(MLIRContext *context) #include "mlir/LLVMIR/LLVMOps.cpp.inc" /// Parse a type registered to this dialect. -Type LLVMDialect::parseType(StringRef tyData, Location loc, - MLIRContext *context) const { +Type LLVMDialect::parseType(StringRef tyData, Location loc) const { llvm::SMDiagnostic errorMessage; llvm::Type *type = llvm::parseType(tyData, errorMessage, module); if (!type) - return (context->emitError(loc, errorMessage.getMessage()), nullptr); - return LLVMType::get(context, type); + return (getContext()->emitError(loc, errorMessage.getMessage()), nullptr); + return LLVMType::get(getContext(), type); } /// Print a type registered to this dialect. diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp index 0301d9a4006f..78d9e6400e03 100644 --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -518,7 +518,7 @@ Type Parser::parseExtendedType() { // If we found a registered dialect, then ask it to parse the type. if (auto *dialect = state.context->getRegisteredDialect(identifier)) { - result = dialect->parseType(typeData, loc, state.context); + result = dialect->parseType(typeData, loc); if (!result) return nullptr; } else {