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

Wang, Xin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 23:58:21 PDT 2023


XinWang10 marked an inline comment as done.
XinWang10 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();
----------------
MaskRay wrote:
> `MMI->` expresses the intention that MMI cannot be nullptr. This assert has very little value. I think we generally don't add it.
OK, I may mov this to higher level to avoid static analyzer report in another patch.


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