[all-commits] [llvm/llvm-project] 99fb65: [NFC]Add assert to avoid possibly deref nullptr (#...

XinWang10 via All-commits all-commits at lists.llvm.org
Thu Sep 7 19:10:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 99fb65fa7a65b9a3f961d6ef715324c2f8637766
      https://github.com/llvm/llvm-project/commit/99fb65fa7a65b9a3f961d6ef715324c2f8637766
  Author: XinWang10 <108658776+XinWang10 at users.noreply.github.com>
  Date:   2023-09-08 (Fri, 08 Sep 2023)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
    M llvm/lib/Target/X86/X86AsmPrinter.cpp

  Log Message:
  -----------
  [NFC]Add assert to avoid possibly deref nullptr (#65564)

These 2 functions could be called by AsmPrinter::doInitialization in
AsmPrinter.cpp. doInitialization init MMI in the beginning`MMI = MMIWP ?
&MMIWP->getMMI() : nullptr;`, MMI has the possibility to be nullptr,
which could make the later deref crash. I think in most time MMI could
not be nullptr, but from the view of function implementation, it could
be, so I'd like to add assert to it, if this could be a problem, then we
could avoid crash.




More information about the All-commits mailing list