[llvm] [llvm-remarkutil] Auto-detect serializer format based on file extension (PR #160545)

Tobias Stadler via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 24 09:38:05 PDT 2025


================
@@ -46,12 +46,8 @@ static Error tryFilter() {
     return MaybeParser.takeError();
   auto &Parser = **MaybeParser;
 
-  Format SerializerFormat = OutputFormat;
-  if (SerializerFormat == Format::Auto) {
-    SerializerFormat = Parser.ParserFormat;
-    if (OutputFileName.empty() || OutputFileName == "-")
-      SerializerFormat = Format::YAML;
-  }
+  Format SerializerFormat =
+      getSerializerFormat(OutputFileName, OutputFormat, Parser.ParserFormat);
 
----------------
tobias-stadler wrote:

It's a difficult trade-off imo. Working with these tools interactively in a tty, I personally like YAML as the default. I find that most often I call e.g. filter on huge bitstream files and pipe the result straight into vim/less for inspection. So if we do this, maybe instead of emitting the warning we can auto-switch to YAML if we detect tty and also add sth like `-S` as a shorthand for `--serializer=yaml`?

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


More information about the llvm-commits mailing list