[llvm] [Tablegen] Add keyword `dump`. (PR #68793)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 16:53:19 PDT 2023


================
@@ -170,4 +170,12 @@ void CheckAssert(SMLoc Loc, Init *Condition, Init *Message) {
   }
 }
 
+// Dump a message to stderr.
+void dumpMessage(SMLoc Loc, Init *Message) {
+  if (auto *MessageInit = dyn_cast<StringInit>(Message))
+    PrintNote(Loc, MessageInit->getValue());
+  else
+    PrintWarning(Loc, "dump message is not a string - use `!repr`");
----------------
Artem-B wrote:

Given that it's the only failure mode with the only actionable fix, should we magically wrap non-string inputs in `!repr` and allow `dump` to print out anything?

https://github.com/llvm/llvm-project/pull/68793


More information about the llvm-commits mailing list