This is an archive of the discontinued LLVM Phabricator instance.

[libTooling] Move `RewriteRule` abstraction into its own header and impl.
ClosedPublic

Authored by ymandel on Oct 10 2019, 8:33 AM.

Details

Summary

Move the RewriteRule class and related declarations into its own set of files
(header, implementation). Only the Transformer class is left in the
Transformer-named files. This change clarifies the distinction between the
RewriteRule class, which is essential to the Transformer library, and the
Transformer class, which is only one possible RewriteRule interpreter
(compare to TransformerClangTidyCheck, a clang-tidy based interpreter).

Diff Detail

Event Timeline

ymandel created this revision.Oct 10 2019, 8:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2019, 8:33 AM
Herald added a subscriber: jfb. · View Herald Transcript
gribozavr added inline comments.Oct 10 2019, 8:40 AM
clang/include/clang/Tooling/Transformer/Transformer.h
58

I'm not a fan of umbrella headers... especially if they don't cover everything.

I think "include what you use" is a better rule.

The rest of the patch makes sense to me, just not this file. (OK to keep it temporarily if we need it to help clients migrate, of course.)

ymandel marked an inline comment as done.Oct 10 2019, 9:52 AM
ymandel added inline comments.
clang/include/clang/Tooling/Transformer/Transformer.h
58

Thanks, sounds good. In that case, might it make more sense to just split off RewriteRule and not rename Transformer -> TransformerTool (along w/ the correpsonding header change)? My primary motivation for renaming the class was to allow Transformer to be the name for the umbrella.

Since Transformer.h will have to include RewriteRule.h anyhow, there won't be any need for a forwarding header while we update users.

ymandel updated this revision to Diff 224414.Oct 10 2019, 10:50 AM

Removed umbrella-header, as per discussion.

ymandel marked an inline comment as done.Oct 10 2019, 10:53 AM
ymandel added inline comments.
clang/include/clang/Tooling/Transformer/Transformer.h
58

I've uploaded a new diff w/ these changes. I also split the implementation file, which I'd forgotten to do previously. I've left the test in one file because testing the RewriteRule code w/o Transformer is somewhat complicated. It's probably worth doing that work, but doesn't seem critical at this point just for the sake of somewhat more independent unit tests.

gribozavr accepted this revision.Oct 11 2019, 1:27 AM
This revision is now accepted and ready to land.Oct 11 2019, 1:27 AM
ymandel retitled this revision from [libTooling] Introduce a single, "main" header file for Transformer. to [libTooling] Move `RewriteRule` abstraction into its own header and impl..Oct 11 2019, 7:01 AM
ymandel edited the summary of this revision. (Show Details)

updated title & description to match the changes.

This revision was automatically updated to reflect the committed changes.