This is an archive of the discontinued LLVM Phabricator instance.

Added applyAllReplacementsAndFormat that works for multiple files.
AbandonedPublic

Authored by ioeric on Mar 1 2016, 5:42 AM.

Details

Summary

Added applyAllReplacementsAndFormat that works for multiple files.

Diff Detail

Event Timeline

ioeric updated this revision to Diff 49479.Mar 1 2016, 5:42 AM
ioeric retitled this revision from to Added applyAllReplacementsAndFormat that works for multiple files..
ioeric updated this object.
ioeric added a reviewer: klimek.
ioeric added subscribers: klimek, cfe-commits.
ioeric updated this revision to Diff 49487.Mar 1 2016, 6:07 AM
  • Fixed commenting issue due to merge.
ioeric updated this revision to Diff 49493.Mar 1 2016, 7:20 AM
  • Added getOrCreateFileID interface in SourceManager.
djasper edited edge metadata.Mar 1 2016, 9:47 PM

I don't think this is the right abstraction:

  • Formatting so far is fundamentally per file. Grouping replacements per file is something that can be done outside of libFormat.
  • The logic to sort and deduplicate Replacements is important independent of whether formatting is done on them. So this should also go outside of libFormat.
klimek edited edge metadata.Mar 2 2016, 12:59 AM

Ok, after thinking about it a bit, here is a new plan:

  • get rid of applyAllReplacementsAndFormat (in all its forms)
  • implement a formatRewrittenCode(Rewriter&, ...); as Daniel wants libFormat to stay file focused, we can put that into non-core libTooling; it'll figure out what to reformat from the rewriter state

That should leave us with a set of single purpose functions we can nicely combine.

ioeric updated this revision to Diff 49619.Mar 2 2016, 7:23 AM
ioeric edited edge metadata.
  • Removed all applyAllReplacementsAndFormat(*); added formatRewrittenCode in clangTooling.
ioeric updated this revision to Diff 49620.Mar 2 2016, 7:25 AM
  • Removed definitions that were forgotten.
ioeric abandoned this revision.Mar 3 2016, 7:31 AM

Start a new revision to put applyAllReplacementsAndFormat into non-core libTooling .