[PATCH] D62419: [LibTooling] Add `before` and `after` selectors for selecting point-ranges relative to nodes.
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 28 09:26:00 PDT 2019
ilya-biryukov accepted this revision.
ilya-biryukov marked an inline comment as done.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.
LGTM!
================
Comment at: clang/lib/Tooling/Refactoring/RangeSelector.cpp:124
+ return CharSourceRange::getCharRange(Lexer::getLocForEndOfToken(
+ SelectedRange->getEnd(), 0, Result.Context->getSourceManager(),
+ Result.Context->getLangOpts()));
----------------
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
================
Comment at: clang/unittests/Tooling/RangeSelectorTest.cpp:130
+ int f(int x, int y, int z) { return 3; }
+ int g() { return f(/* comment */ 3, 7 /* comment */, 9); }
+ )cc";
----------------
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62419/new/
https://reviews.llvm.org/D62419
More information about the cfe-commits
mailing list