[PATCH] D77481: Make the AsmPrinter print "<null type>" instead of crashing on null types

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 11:44:49 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG96eb38418bcc: Make the AsmPrinter print "<<NULL TYPE>>" instead of crashing on null types (authored by mehdi_amini).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77481

Files:
  mlir/lib/IR/AsmPrinter.cpp


Index: mlir/lib/IR/AsmPrinter.cpp
===================================================================
--- mlir/lib/IR/AsmPrinter.cpp
+++ mlir/lib/IR/AsmPrinter.cpp
@@ -1490,6 +1490,11 @@
 }
 
 void ModulePrinter::printType(Type type) {
+  if (!type) {
+    os << "<<NULL TYPE>>";
+    return;
+  }
+
   // Check for an alias for this type.
   if (state) {
     StringRef alias = state->getAliasState().getTypeAlias(type);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77481.255177.patch
Type: text/x-patch
Size: 422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200405/aa9bb5d5/attachment.bin>


More information about the llvm-commits mailing list