At the moment refactor-check-compiles invokes swift-refactor twice, once to generate the output for -dump-text and once to generate the output for -dump-rewritten. This is duplicated effort. We should instead add an option to swift-refactor that outputs -dump-text to stdout and the contents of -dump-rewritten to a file. That way we could be generating both representations at the same time.
If anyone wants to tackle this as a starter bug:
You would need to add a new flag like -rewritten-output-file in swift-refactor.cpp that dumps the rewritten text to the specified output file, just like the DumpType::REWRITTEN case does today here
Afterwards, you’d need to update refactory-check-compiles.py to use that new argument to swift-refactor to retrieve the rewritten code together with the invocation that has -dump-rewritten, getting rid of the path that calls -dump-text and writes its stdout to the temp file.
The text was updated successfully, but these errors were encountered:
Thanks for taking a look at this. The Python code looks good so far. Once you’ve got the changes for swift-refactor.cpp ready, could you open a PR on, so we can discuss them there? For that, I suggest you look at what we’re already doing for -dump-rewritten and at llvm::raw_fd_ostream to redirect the output to a file instead of stdout.