diff --git a/llvm/lib/TableGen/Error.cpp b/llvm/lib/TableGen/Error.cpp index dabb265ef80ca1..4b99ff89da3b93 100644 --- a/llvm/lib/TableGen/Error.cpp +++ b/llvm/lib/TableGen/Error.cpp @@ -173,8 +173,11 @@ void CheckAssert(SMLoc Loc, Init *Condition, Init *Message) { // Dump a message to stderr. void dumpMessage(SMLoc Loc, Init *Message) { auto *MessageInit = dyn_cast(Message); - assert(MessageInit && "no debug message to print"); - PrintNote(Loc, MessageInit->getValue()); + if (!MessageInit) { + PrintError(Loc, "dump value is not of type string"); + } else { + PrintNote(Loc, MessageInit->getValue()); + } } } // end namespace llvm