[PATCH] D119133: [flang][nfc] Add an assert to guard against `nullptr` dereferencing

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 8 02:47:08 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8d248002a66b: [flang][nfc] Add an assert to guard against `nullptr` dereferencing (authored by awarzynski).

Changed prior to commit:
  https://reviews.llvm.org/D119133?vs=406423&id=406751#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119133/new/

https://reviews.llvm.org/D119133

Files:
  flang/include/flang/Lower/Bridge.h


Index: flang/include/flang/Lower/Bridge.h
===================================================================
--- flang/include/flang/Lower/Bridge.h
+++ flang/include/flang/Lower/Bridge.h
@@ -64,7 +64,10 @@
   //===--------------------------------------------------------------------===//
 
   mlir::MLIRContext &getMLIRContext() { return context; }
-  mlir::ModuleOp &getModule() { return *module.get(); }
+  mlir::ModuleOp &getModule() {
+    assert(module && "This bridge is missing an MLIR module");
+    return *module.get();
+  }
   const Fortran::common::IntrinsicTypeDefaultKinds &getDefaultKinds() const {
     return defaultKinds;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119133.406751.patch
Type: text/x-patch
Size: 646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220208/f998df6a/attachment.bin>


More information about the llvm-commits mailing list