projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
26e6880
)
Make the AsmPrinter print "<<NULL TYPE>>" instead of crashing on null types
author
Mehdi Amini
<joker.eph@gmail.com>
Sun, 5 Apr 2020 03:01:21 +0000
(
03:01
+0000)
committer
Mehdi Amini
<joker.eph@gmail.com>
Sun, 5 Apr 2020 18:36:18 +0000
(18:36 +0000)
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.
Differential Revision: https://reviews.llvm.org/D77481
mlir/lib/IR/AsmPrinter.cpp
patch
|
blob
|
history
diff --git
a/mlir/lib/IR/AsmPrinter.cpp
b/mlir/lib/IR/AsmPrinter.cpp
index
bc680cf
..
987c6b9
100644
(file)
--- a/
mlir/lib/IR/AsmPrinter.cpp
+++ b/
mlir/lib/IR/AsmPrinter.cpp
@@
-1490,6
+1490,11
@@
void ModulePrinter::printDenseElementsAttr(DenseElementsAttr attr,
}
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);