Skip to content

Conversation

tobias-stadler
Copy link
Contributor

If serializer format is set to Auto, try to detect user intent based on
the file extension of the output file name.

Created using spr 1.3.7-wip
@tobias-stadler tobias-stadler requested review from fhahn and jroelofs and removed request for fhahn September 24, 2025 15:56
}
Format SerializerFormat =
getSerializerFormat(OutputFileName, OutputFormat, Parser.ParserFormat);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about making the default be bitstream (unless the input was yaml), and then adding a warning/error message here if the output is a tty, kind of like opt does when you try to write bitcode to the terminal? I think our "north star" should be to converge on "bitstream for everything except LIT tests".

Copy link
Contributor Author

@tobias-stadler tobias-stadler Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to make piping into text based tools easier?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that!

tobias-stadler added a commit to tobias-stadler/llvm-project that referenced this pull request Sep 26, 2025
If serializer format is set to Auto, try to detect user intent based on
the file extension of the output file name.

Pull Request: llvm#160545
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants