forked from OSchip/llvm-project
Avoid failing when attempting to print null Attribute.
This avoids segfaulting when dumping during debugging of failures. PiperOrigin-RevId: 223449494
This commit is contained in:
parent
a619b5c295
commit
21ed46abb8
|
@ -408,6 +408,11 @@ void ModulePrinter::printFunctionReference(const Function *func) {
|
|||
}
|
||||
|
||||
void ModulePrinter::printAttribute(Attribute attr) {
|
||||
if (!attr) {
|
||||
os << "<<NULL ATTRIBUTE>>";
|
||||
return;
|
||||
}
|
||||
|
||||
switch (attr.getKind()) {
|
||||
case Attribute::Kind::Bool:
|
||||
os << (attr.cast<BoolAttr>().getValue() ? "true" : "false");
|
||||
|
|
Loading…
Reference in New Issue