This is an archive of the discontinued LLVM Phabricator instance.

[libTooling] Simplify the representation of Transformer's RewriteRules.
ClosedPublic

Authored by ymandel on Apr 3 2020, 10:58 AM.

Details

Summary

This revision simplifies the representation of edits in rewrite rules. The
simplified form is more general, allowing the user more flexibility in building
custom edit specifications.

The changes extend the API, without changing the signature of existing
functions. So this only risks breaking users that directly accessed the
RewriteRule struct.

Diff Detail

Event Timeline

ymandel created this revision.Apr 3 2020, 10:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2020, 10:58 AM
Herald added a subscriber: jfb. · View Herald Transcript
gribozavr2 accepted this revision.Apr 7 2020, 8:27 AM
gribozavr2 added inline comments.
clang/include/clang/Tooling/Transformer/RewriteRule.h
40

"A map"? it is a function.

Maybe "Maps a match result to..."

Also, "concrete errors" probably should be "concrete edits".

44

Could you explain the idea behind the word "list" in the name? I don't get it.

Maybe "EditGenerator"?

This revision is now accepted and ready to land.Apr 7 2020, 8:27 AM
ymandel marked 2 inline comments as done.Apr 7 2020, 10:06 AM
ymandel added inline comments.
clang/include/clang/Tooling/Transformer/RewriteRule.h
40

agreed on both. will update.

44

It returns a list of edits. So, EditListGenerator is probably most precise, but I wasn't sure that "generator" added much. I'm fine with any of the names, EditGenerator probably being best (if we want Generator in the name) because its concise while still aligning with multiple edits (since a generator often can generate more than one item). WDYT?

ymandel updated this revision to Diff 255733.Apr 7 2020, 10:56 AM

replaced name; fixed comments.

ymandel updated this revision to Diff 255734.Apr 7 2020, 10:56 AM

clang-format

Harbormaster failed remote builds in B52183: Diff 255733!
gribozavr2 accepted this revision.Apr 8 2020, 3:50 AM
gribozavr2 marked an inline comment as done.
gribozavr2 added inline comments.
clang/include/clang/Tooling/Transformer/RewriteRule.h
44

I suggested "generator" to make some indication that it is not a data structure that stores edits, but some precursor. EditGenerator SGTM.

ymandel marked 2 inline comments as done.Apr 8 2020, 5:41 AM

Thanks for the review!

This revision was automatically updated to reflect the committed changes.