Remove the MLIRContext parameter from Dialect::parseType. Dialects already have access to the context via Dialect::getContext.

--

PiperOrigin-RevId: 241047077
This commit is contained in:
River Riddle
2019-03-29 14:06:51 -07:00
committed by jpienaar
parent 258dbdafa8
commit 0ae68a3ccf
5 changed files with 9 additions and 13 deletions

View File

@@ -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 '"'

View File

@@ -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;

View File

@@ -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();
}

View File

@@ -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.

View File

@@ -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 {