bloomberg / clangmetatool

A framework for reusing code in Clang tools
https://bloomberg.github.io/clangmetatool/
Apache License 2.0
119 stars 25 forks source link

Add exportReplacements function #63

Closed begroh closed 3 years ago

begroh commented 3 years ago

Describe your changes Add an exportChanges() function to MetaToolFactory that outputs all of the replacements generated by a tool's run in YAML format. These changes can be applied to a project with clang-apply-replacements.

Testing performed Compiled a tool against this branch and ran runAndExportChanges. Replacements file was successfully generated and applied.

ruoso commented 3 years ago

I wonder if it would be useful to have a runAndExportChanges that is symmetrical to runAndSave.

begroh commented 3 years ago

I wonder if it would be useful to have a runAndExportChanges that is symmetrical to runAndSave.

It wouldn't be totally analogous since we call runAndSave on the RefactoringTool and pass in the MetaToolFactory, but I suppose we could pass the tool in and call run with this.

ruoso commented 3 years ago

Can we add a test case to validate the generated yaml?