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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 13:08:14 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();
----------------
XinWang10 wrote:
> 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.
Please just don't send patches just to appease static analyzer. Their reports must be analyzed. Low value reports can be turned down/ignored.


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