[PATCH] D157948: [NFC] Fix possibly deref nullptr

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 20:15:10 PDT 2023


MaskRay added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:386
 const DataLayout &AsmPrinter::getDataLayout() const {
+  assert(MMI && "MMI could not be nullptr!");
   return MMI->getModule()->getDataLayout();
----------------
`MMI->` expresses the intention that MMI cannot be nullptr. This assert has very little value. I think we generally don't add it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157948



More information about the llvm-commits mailing list