mirror of
https://github.com/intel/llvm.git
synced 2026-02-02 02:00:03 +08:00
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:
@@ -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 '"'
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user