diff --git a/flang/include/flang/Lower/Bridge.h b/flang/include/flang/Lower/Bridge.h --- a/flang/include/flang/Lower/Bridge.h +++ b/flang/include/flang/Lower/Bridge.h @@ -64,10 +64,10 @@ //===--------------------------------------------------------------------===// mlir::MLIRContext &getMLIRContext() { return context; } - mlir::ModuleOp &getModule() { - assert(module && "This bridge is missing an MLIR module"); - return *module.get(); - } + + /// Get the ModuleOp. It can never be null, which is asserted in the ctor. + mlir::ModuleOp &getModule() { return *module.get(); } + const Fortran::common::IntrinsicTypeDefaultKinds &getDefaultKinds() const { return defaultKinds; } @@ -84,8 +84,6 @@ /// Create a folding context. Careful: this is very expensive. Fortran::evaluate::FoldingContext createFoldingContext() const; - bool validModule() { return (module != nullptr); } - //===--------------------------------------------------------------------===// // Perform the creation of an mlir::ModuleOp //===--------------------------------------------------------------------===// diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -2454,6 +2454,6 @@ module = std::make_unique( mlir::ModuleOp::create(mlir::UnknownLoc::get(&context))); assert(module.get() && "module was not created"); - fir::setTargetTriple(*module.get(), triple); - fir::setKindMapping(*module.get(), kindMap); + fir::setTargetTriple(getModule(), triple); + fir::setKindMapping(getModule(), kindMap); }