[PATCH] D24322: clang-format: [JavaScript] Do requoting in a separate pass

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 7 15:41:12 PDT 2016

djasper created this revision.
djasper added a reviewer: mprobst.
djasper added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

The attempt to fix requoting behavior in r280487 after changes to tooling::Replacements are incomplete. We essentially need to add to replacements at the same position, one to insert a line break and one to change the quoting and that's incompatible with the new tooling::Replacement API, which does not allow for order-dependent Replacements. To make the order clear, Replacements::merge() has to be used, but that requires the merged Replacement to actually refer to the changed text, which is hard to reproduce for the requoting.

This change fixes the behavior by moving the requoting to a completely separate pass. The added benefit is that no weird ColumnWidth calculations are necessary anymore and this should just work even if we implement string literal splitting in the future.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24322.70611.patch
Type: text/x-patch
Size: 7771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160907/2b6041b0/attachment-0001.bin>

More information about the cfe-commits mailing list