[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
Sat Apr 4 21:50:52 PDT 2020


mehdi_amini updated this revision to Diff 255108.
mehdi_amini added a comment.

Update format to `<<NULL TYPE>>` for consistency with attributes


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.255108.patch
Type: text/x-patch
Size: 422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200405/5be5e9c4/attachment.bin>


More information about the llvm-commits mailing list