[PATCH] D21547: Added calculateRangesAfterReplaments() to calculate affacted ranges in the new code.
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 21 10:54:15 PDT 2016
ioeric added inline comments.
================
Comment at: lib/Tooling/Core/Replacement.cpp:285
@@ +284,3 @@
+ [](const Range &LHS, const Range &RHS) -> bool {
+ if (LHS.getOffset() != RHS.getOffset())
+ return LHS.getOffset() < RHS.getOffset();
----------------
djasper wrote:
> or std::tie(LHS.getOffset(), LHS.getLength()) < std::tie(RHS.getOffset(), RHS.getLength())?
I tried std::tie(args...), but it takes references of args...and return values are temp values.
================
Comment at: lib/Tooling/Core/Replacement.cpp:292
@@ +291,3 @@
+ if (Result.empty() ||
+ Result.back().getOffset() + Result.back().getLength() < R.getOffset()) {
+ Result.push_back(R);
----------------
djasper wrote:
> Maybe pull out:
> unsigned CurrentEnd = Result.back().getOffset() + Result.back().getLength();
>
> Will probably save a line or two :)
But there is Result.empty()...?
http://reviews.llvm.org/D21547
More information about the cfe-commits
mailing list