This encapsulates 3 changes:
- DotDumpVisitor now aggregates strings instead of bytes for both python2 and python3. This difference caused crashes when it tried to write out the content as strings, similarly described at D71746.
- graphviz.pipe() expects the input in *bytes* instead of unicode strings. And it results in bytes. Due to string concatenations and similar operations, I'm using unicode string as the default and converting to bytes on demand.
- write_temp_file() now appends the egraph- prefix and more importantly, it will create the temp file in the current working directory instead of in the temp. This change makes Firefox be able to open the file even if the security.sandbox.content.level is set to the (default) most restricting 4. See https://support.mozilla.org/si/questions/1259285
An artifact of the bad byte handling was previously in the HTML
produced by the script that it displayed the b' string at the top left
corner. Now it won't anymore :)
I've tested that the following command works on Ubuntu 22.04:
exploded-graph-rewriter my-egraph.dot
Both python2 and python3 works as expected.
PS: I'm not adding tests, as the current test infra does not support
testing HTML outputs for this script.
Check the clang/test/Analysis/exploded-graph-rewriter/lit.local.cfg.
We always pass the --dump-dot-only flag to the script.
Along with that, the default invocation will not only create this HTML
report but also try to open it. In addition to this, I'm not sure if the
buildbots have graphviz installed and also if this package is installed
on pip.
Unless we change some of these, we cannot test this change.
Given that D71746 had no tests, I'm not too worried about this either.
I think the reminder is still relevant. These files can be like 100mb in size, and now that they aren't in /tmp they aren't autocleaned.