[PATCH] D77481: Make the AsmPrinter print "<null type>" instead of crashing on null types
Uday Bondhugula via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 4 20:46:48 PDT 2020
bondhugula accepted this revision.
bondhugula added inline comments.
================
Comment at: mlir/lib/IR/AsmPrinter.cpp:1494
+ if (!type) {
+ os << "<null type>";
+ return;
----------------
This change is very welcome, thanks! It would be good keep the message format consistent though - there are other places in the ASM printer that handle such null structures. Can we make the casing and angular brackets uniform? (changing to your format sounds good).
```
if (!value) {
stream << "<<NULL>>";
return;
}
```
```
if (!attr) {
os << "<<NULL ATTRIBUTE>>";
return;
}
```
```
void AffineExpr::print(raw_ostream &os) const {
if (expr == nullptr) {
os << "null affine expr";
return;
}
```
```
void AffineExpr::dump() const {
print(llvm::errs());
llvm::errs() << "\n";
}
void AffineMap::print(raw_ostream &os) const {
if (map == nullptr) {
os << "null affine map";
return;
}
ModulePrinter(os).printAffineMap(*this);
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77481/new/
https://reviews.llvm.org/D77481
More information about the llvm-commits
mailing list