Page MenuHomePhabricator

[LibTooling] Add `before` and `after` selectors for selecting point-ranges relative to nodes.

Authored by ymandel on May 24 2019, 12:34 PM.



The before and after selectors allow users to specify a zero-length range -- a point -- at the relevant location in an AST-node's source. Point ranges can be useful, for example, to insert a change using an API that takes a range to be modified (e.g. tooling::change()).

Diff Detail


Event Timeline

ymandel created this revision.May 24 2019, 12:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2019, 12:34 PM
ymandel edited the summary of this revision. (Show Details)May 24 2019, 12:35 PM
ilya-biryukov accepted this revision.May 28 2019, 9:22 AM
ilya-biryukov marked an inline comment as done.


124 ↗(On Diff #201315)

Ah, we're so lucky to have the source manager here!
It did not occur to me that having MatchResult means we also have access to all helper structs we need

130 ↗(On Diff #201315)

NIT: Consider using llvm::Annotations from llvm/Testing/Support, they might help to produce more readable tests.
It allow to mark ranges inside the input text with a special syntax and get offsets for those.

No need to change anything in this revision, obviously.

This revision is now accepted and ready to land.May 28 2019, 9:22 AM
This revision was automatically updated to reflect the committed changes.
ymandel marked 2 inline comments as done.
Herald added a project: Restricted Project. · View Herald TranscriptMay 29 2019, 5:42 AM