This is an archive of the discontinued LLVM Phabricator instance.

[libTooling] Add `ifBound`, `elseBranch` RangeSelector combinators.
ClosedPublic

Authored by ymandel on Sep 16 2019, 7:39 AM.

Details

Summary

Adds two new combinators and corresponding tests to the RangeSelector library.

  • ifBound -- conditional evaluation of range-selectors, based on whether a given node id is bound in the match.
  • elseBranch -- selects the source range of the else and its statement.

Diff Detail

Repository
rL LLVM

Event Timeline

ymandel created this revision.Sep 16 2019, 7:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2019, 7:39 AM
gribozavr accepted this revision.Sep 20 2019, 6:08 AM
gribozavr added inline comments.
clang/lib/Tooling/Refactoring/RangeSelector.cpp
320 ↗(On Diff #220340)

May I ask to keep the implementation order consistent with the header file?

This revision is now accepted and ready to land.Sep 20 2019, 6:08 AM
ymandel updated this revision to Diff 221050.Sep 20 2019, 9:31 AM
ymandel marked 2 inline comments as done.

reordered decls

ymandel added inline comments.Sep 20 2019, 9:33 AM
clang/lib/Tooling/Refactoring/RangeSelector.cpp
320 ↗(On Diff #220340)

Moved the decl in the header to match the ordering in the implementation, which results in a better grouping (in terms of the signature and semantics of the combinators).

ymandel updated this revision to Diff 221052.Sep 20 2019, 9:45 AM

reordered tests to match as well.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2019, 10:09 AM