[PATCH] D21547: Added calculateRangesAfterReplaments() to calculate affacted ranges in the new code.
Daniel Jasper via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 21 09:58:36 PDT 2016
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.
A couple of small comments, otherwise looks good.
================
Comment at: lib/Tooling/Core/Replacement.cpp:284
@@ +283,3 @@
+ std::sort(Ranges.begin(), Ranges.end(),
+ [](const Range &LHS, const Range &RHS) -> bool {
+ if (LHS.getOffset() != RHS.getOffset())
----------------
I don't think you need "-> bool".
================
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();
----------------
or std::tie(LHS.getOffset(), LHS.getLength()) < std::tie(RHS.getOffset(), RHS.getLength())?
================
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);
----------------
Maybe pull out:
unsigned CurrentEnd = Result.back().getOffset() + Result.back().getLength();
Will probably save a line or two :)
http://reviews.llvm.org/D21547
More information about the cfe-commits
mailing list