Skip to content

Commit 82fdfd4

Browse files
authored
[TableGen] Print Error and not crash on dumping non-string values (#104568)
Co-authored-by: Akshat Oke <[email protected]>
1 parent a80a90e commit 82fdfd4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/TableGen/Error.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,11 @@ void CheckAssert(SMLoc Loc, Init *Condition, Init *Message) {
173173
// Dump a message to stderr.
174174
void dumpMessage(SMLoc Loc, Init *Message) {
175175
auto *MessageInit = dyn_cast<StringInit>(Message);
176-
assert(MessageInit && "no debug message to print");
177-
PrintNote(Loc, MessageInit->getValue());
176+
if (!MessageInit) {
177+
PrintError(Loc, "dump value is not of type string");
178+
} else {
179+
PrintNote(Loc, MessageInit->getValue());
180+
}
178181
}
179182

180183
} // end namespace llvm

0 commit comments

Comments
 (0)