Skip to content

Commit 4258553

Browse files
committed
Fix linter errors
1 parent f3ca462 commit 4258553

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

bindings/mlir/register_mlir.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,12 @@
4040
#include <nanobind/nanobind.h>
4141
#include <nanobind/stl/string.h> // NOLINT(misc-include-cleaner)
4242

43-
#include <algorithm>
4443
#include <cctype>
4544
#include <filesystem>
46-
#include <fstream>
47-
#include <iterator>
4845
#include <memory>
49-
#include <optional>
50-
#include <ranges>
5146
#include <stdexcept>
5247
#include <string>
48+
#include <utility>
5349

5450
namespace mqt {
5551

@@ -115,9 +111,8 @@ moduleFromMlirFile(mlir::MLIRContext* context, const std::string& path) {
115111
std::string errorMessage;
116112
auto file = mlir::openInputFile(path, &errorMessage);
117113
if (!file) {
118-
llvm::errs() << "Failed to load file '" << path << "': '" << errorMessage
119-
<< "'\n";
120-
return nullptr;
114+
throw std::runtime_error(std::string("Failed to load file '") + path +
115+
"': '" + errorMessage + "'");
121116
}
122117

123118
llvm::SourceMgr sourceMgr;
@@ -142,9 +137,8 @@ moduleFromQasmFile(mlir::MLIRContext* context, const std::string& path) {
142137
std::string errorMessage;
143138
auto file = mlir::openInputFile(path, &errorMessage);
144139
if (!file) {
145-
llvm::errs() << "Failed to load file '" << path << "': '" << errorMessage
146-
<< "'\n";
147-
return nullptr;
140+
throw std::runtime_error(std::string("Failed to load file '") + path +
141+
"': '" + errorMessage + "'");
148142
}
149143

150144
llvm::SourceMgr sourceMgr;

0 commit comments

Comments
 (0)