[PATCH] D97258: [llvm] Add assertions for the smart pointers with the possibility to be null in ModuleLazyLoaderCache::operator()

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 13:55:09 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0de3d1c81428: [llvm] Add assertions for the smart pointers with the possibility to be null in… (authored by OikawaKirie, committed by tejohnson).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97258

Files:
  llvm/tools/llvm-link/llvm-link.cpp


Index: llvm/tools/llvm-link/llvm-link.cpp
===================================================================
--- llvm/tools/llvm-link/llvm-link.cpp
+++ llvm/tools/llvm-link/llvm-link.cpp
@@ -246,8 +246,10 @@
 Module &ModuleLazyLoaderCache::operator()(const char *argv0,
                                           const std::string &Identifier) {
   auto &Module = ModuleMap[Identifier];
-  if (!Module)
+  if (!Module) {
     Module = createLazyModule(argv0, Identifier);
+    assert(Module && "Failed to create lazy module!");
+  }
   return *Module;
 }
 } // anonymous namespace


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97258.331995.patch
Type: text/x-patch
Size: 582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210319/a0ba785f/attachment.bin>


More information about the llvm-commits mailing list