[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 20:14:46 PDT 2020
mehdi_amini created this revision.
mehdi_amini added a reviewer: rriddle.
Herald added subscribers: llvm-commits, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar.
Herald added 1 blocking reviewer(s): rriddle.
Herald added a project: LLVM.
Even if this indicates in general a problem at call sites, the printer
is used for debugging and avoiding crashing is friendlier for example
when used in diagnostics or other printer.
Repository:
rG LLVM Github Monorepo
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.255101.patch
Type: text/x-patch
Size: 420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200405/f70fb016/attachment-0001.bin>
More information about the llvm-commits
mailing list