[MLIR] Change call sites from deprecated parseSourceFile() to parseSourceFile<ModuleOp>().
Mark `parseSourceFile()` deprecated. The functions will be removed two weeks after landing this change. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D121075
This commit is contained in:
@@ -98,7 +98,7 @@ int dumpMLIR() {
|
||||
llvm::SourceMgr sourceMgr;
|
||||
sourceMgr.AddNewSourceBuffer(std::move(*fileOrErr), llvm::SMLoc());
|
||||
mlir::OwningOpRef<mlir::ModuleOp> module =
|
||||
mlir::parseSourceFile(sourceMgr, &context);
|
||||
mlir::parseSourceFile<mlir::ModuleOp>(sourceMgr, &context);
|
||||
if (!module) {
|
||||
llvm::errs() << "Error can't load file " << inputFilename << "\n";
|
||||
return 3;
|
||||
|
||||
@@ -93,7 +93,7 @@ int loadMLIR(llvm::SourceMgr &sourceMgr, mlir::MLIRContext &context,
|
||||
|
||||
// Parse the input mlir.
|
||||
sourceMgr.AddNewSourceBuffer(std::move(*fileOrErr), llvm::SMLoc());
|
||||
module = mlir::parseSourceFile(sourceMgr, &context);
|
||||
module = mlir::parseSourceFile<mlir::ModuleOp>(sourceMgr, &context);
|
||||
if (!module) {
|
||||
llvm::errs() << "Error can't load file " << inputFilename << "\n";
|
||||
return 3;
|
||||
|
||||
@@ -94,7 +94,7 @@ int loadMLIR(llvm::SourceMgr &sourceMgr, mlir::MLIRContext &context,
|
||||
|
||||
// Parse the input mlir.
|
||||
sourceMgr.AddNewSourceBuffer(std::move(*fileOrErr), llvm::SMLoc());
|
||||
module = mlir::parseSourceFile(sourceMgr, &context);
|
||||
module = mlir::parseSourceFile<mlir::ModuleOp>(sourceMgr, &context);
|
||||
if (!module) {
|
||||
llvm::errs() << "Error can't load file " << inputFilename << "\n";
|
||||
return 3;
|
||||
|
||||
@@ -98,7 +98,7 @@ int loadMLIR(llvm::SourceMgr &sourceMgr, mlir::MLIRContext &context,
|
||||
|
||||
// Parse the input mlir.
|
||||
sourceMgr.AddNewSourceBuffer(std::move(*fileOrErr), llvm::SMLoc());
|
||||
module = mlir::parseSourceFile(sourceMgr, &context);
|
||||
module = mlir::parseSourceFile<mlir::ModuleOp>(sourceMgr, &context);
|
||||
if (!module) {
|
||||
llvm::errs() << "Error can't load file " << inputFilename << "\n";
|
||||
return 3;
|
||||
|
||||
@@ -119,7 +119,7 @@ int loadMLIR(mlir::MLIRContext &context,
|
||||
// Parse the input mlir.
|
||||
llvm::SourceMgr sourceMgr;
|
||||
sourceMgr.AddNewSourceBuffer(std::move(*fileOrErr), llvm::SMLoc());
|
||||
module = mlir::parseSourceFile(sourceMgr, &context);
|
||||
module = mlir::parseSourceFile<mlir::ModuleOp>(sourceMgr, &context);
|
||||
if (!module) {
|
||||
llvm::errs() << "Error can't load file " << inputFilename << "\n";
|
||||
return 3;
|
||||
|
||||
@@ -119,7 +119,7 @@ int loadMLIR(mlir::MLIRContext &context,
|
||||
// Parse the input mlir.
|
||||
llvm::SourceMgr sourceMgr;
|
||||
sourceMgr.AddNewSourceBuffer(std::move(*fileOrErr), llvm::SMLoc());
|
||||
module = mlir::parseSourceFile(sourceMgr, &context);
|
||||
module = mlir::parseSourceFile<mlir::ModuleOp>(sourceMgr, &context);
|
||||
if (!module) {
|
||||
llvm::errs() << "Error can't load file " << inputFilename << "\n";
|
||||
return 3;
|
||||
|
||||
@@ -206,21 +206,21 @@ inline OwningOpRef<ContainerOpT> parseSourceString(llvm::StringRef sourceStr,
|
||||
|
||||
/// TODO: These methods are deprecated in favor of the above template versions.
|
||||
/// They should be removed when usages have been updated.
|
||||
inline OwningOpRef<ModuleOp> parseSourceFile(const llvm::SourceMgr &sourceMgr,
|
||||
MLIRContext *context) {
|
||||
[[deprecated("use parseSourceFile<ModuleOp>")]] inline OwningOpRef<ModuleOp>
|
||||
parseSourceFile(const llvm::SourceMgr &sourceMgr, MLIRContext *context) {
|
||||
return parseSourceFile<ModuleOp>(sourceMgr, context);
|
||||
}
|
||||
inline OwningOpRef<ModuleOp> parseSourceFile(llvm::StringRef filename,
|
||||
MLIRContext *context) {
|
||||
[[deprecated("use parseSourceFile<ModuleOp>")]] inline OwningOpRef<ModuleOp>
|
||||
parseSourceFile(llvm::StringRef filename, MLIRContext *context) {
|
||||
return parseSourceFile<ModuleOp>(filename, context);
|
||||
}
|
||||
inline OwningOpRef<ModuleOp> parseSourceFile(llvm::StringRef filename,
|
||||
llvm::SourceMgr &sourceMgr,
|
||||
MLIRContext *context) {
|
||||
[[deprecated("use parseSourceFile<ModuleOp>")]] inline OwningOpRef<ModuleOp>
|
||||
parseSourceFile(llvm::StringRef filename, llvm::SourceMgr &sourceMgr,
|
||||
MLIRContext *context) {
|
||||
return parseSourceFile<ModuleOp>(filename, sourceMgr, context);
|
||||
}
|
||||
inline OwningOpRef<ModuleOp> parseSourceString(llvm::StringRef moduleStr,
|
||||
MLIRContext *context) {
|
||||
[[deprecated("use parseSourceFile<ModuleOp>")]] inline OwningOpRef<ModuleOp>
|
||||
parseSourceString(llvm::StringRef moduleStr, MLIRContext *context) {
|
||||
return parseSourceString<ModuleOp>(moduleStr, context);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ static OwningOpRef<ModuleOp> parseMLIRInput(StringRef inputFilename,
|
||||
|
||||
llvm::SourceMgr sourceMgr;
|
||||
sourceMgr.AddNewSourceBuffer(std::move(file), SMLoc());
|
||||
return OwningOpRef<ModuleOp>(parseSourceFile(sourceMgr, context));
|
||||
return parseSourceFile<ModuleOp>(sourceMgr, context);
|
||||
}
|
||||
|
||||
static inline Error makeStringError(const Twine &message) {
|
||||
|
||||
@@ -59,7 +59,7 @@ static LogicalResult performActions(raw_ostream &os, bool verifyDiagnostics,
|
||||
|
||||
// Parse the input file and reset the context threading state.
|
||||
TimingScope parserTiming = timing.nest("Parser");
|
||||
OwningOpRef<ModuleOp> module(parseSourceFile(sourceMgr, context));
|
||||
OwningOpRef<ModuleOp> module(parseSourceFile<ModuleOp>(sourceMgr, context));
|
||||
context->enableMultithreading(wasThreadingEnabled);
|
||||
if (!module)
|
||||
return failure();
|
||||
|
||||
@@ -31,7 +31,7 @@ using namespace mlir;
|
||||
static LogicalResult loadModule(MLIRContext &context,
|
||||
OwningOpRef<ModuleOp> &module,
|
||||
StringRef inputFilename) {
|
||||
module = parseSourceFile(inputFilename, &context);
|
||||
module = parseSourceFile<ModuleOp>(inputFilename, &context);
|
||||
if (!module)
|
||||
return failure();
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ TranslateFromMLIRRegistration::TranslateFromMLIRRegistration(
|
||||
DialectRegistry registry;
|
||||
dialectRegistration(registry);
|
||||
context->appendDialectRegistry(registry);
|
||||
auto module = OwningOpRef<ModuleOp>(parseSourceFile(sourceMgr, context));
|
||||
auto module = parseSourceFile<ModuleOp>(sourceMgr, context);
|
||||
if (!module || failed(verify(*module)))
|
||||
return failure();
|
||||
return function(module.get(), output);
|
||||
|
||||
Reference in New Issue
Block a user