This is an archive of the discontinued LLVM Phabricator instance.

Added interfaces for code-formatting while applying replacements.
ClosedPublic

Authored by ioeric on Feb 29 2016, 12:48 AM.

Details

Reviewers
klimek
Summary

Merge branch 'master' of http://llvm.org/git/clang

Diff Detail

Event Timeline

ioeric updated this revision to Diff 49343.Feb 29 2016, 12:48 AM
ioeric retitled this revision from to Added interfaces for code-formatting while applying replacements..
ioeric updated this object.
ioeric added a reviewer: klimek.
ioeric added a subscriber: cfe-commits.
klimek added inline comments.Feb 29 2016, 1:30 AM
include/clang/Tooling/Core/Replacement.h
227–232

I think we'll need to mainly call out the differences to the function above in the comment.

241–243

I'd probably put the Style parameter last.

lib/Tooling/Core/Replacement.cpp
14–16

Nit: I'd put newlines between the #include groups here.

293

We'll either want to assert that !Replaces.empty() (and document that in the function comment), or do an early exit if that's the case.

305

This comment doesn't carry it's weight, I think. I'd delete it.

316–318

I think we'll want to cut that out for now and implement it so that it works for arbitrary sets of replacements in a follow-up cl.

338

If the inner functions handle this case correctly, we don't need to handle it here.

unittests/Tooling/RefactoringTest.cpp
171–177

If you want to test that breaks happen, it's often better to use a configuration with a smaller column limit.

ioeric updated this revision to Diff 49355.Feb 29 2016, 3:33 AM
ioeric marked 8 inline comments as done.
  • removed applyAllReplacementsAndFormat with Rewritter interface. reduced the column limit in test case; some formatting.
klimek accepted this revision.Feb 29 2016, 3:43 AM
klimek edited edge metadata.

LG

lib/Tooling/Core/Replacement.cpp
290

I'd return a default constructed Replacements() instead - I think that requires a bit less reasoning (as written currently, I'll need to reason that a copy is made to convince myself that this is correct).

This revision is now accepted and ready to land.Feb 29 2016, 3:43 AM
ioeric updated this revision to Diff 49359.Feb 29 2016, 4:26 AM
ioeric marked an inline comment as done.
ioeric edited edge metadata.
  • return Replacements() instead of the empty Replaces.
klimek closed this revision.Feb 29 2016, 8:32 AM

Submitted as r262232