Commit Graph

7 Commits

Author SHA1 Message Date
Daniel Martín
81f87e5e9d Remove dependency on clang::tooling::Replacement
Considering that formatting only affects a single compilation unit, and
that code formatting does not support line ranges yet, remove dependency
on clang::tooling::Replacement.

This fixes SR-2619.
2016-10-02 21:16:31 +02:00
Michael Gottesman
d9882893b9 [swift-format] Check the llvm::Error returned by clang::tooling::Replacements::add to prevent abort.
llvm::Error's destructor has an assert in it that it was checked for success or
failure. This patch puts in a quick check for failure and emits a message to
llvm::errs() and returns failure (which in this case is indicating by returning
true).

A first class diagnostic should be added here, but given that I am preparing for
a stable merge update on a quick time schedule, I did the easy thing (with
respect to the message).
2016-08-31 14:07:18 -07:00
Michael Gottesman
78cb79a34d [upstream-update] clang::tooling::Replacements::insert() => clang::tooling::Replacements::add()
This is just a rename.
2016-08-30 23:14:51 -07:00
Robert Widmann
4ccf6c98dc Merge pull request #4191 from danielmartin/swift-format-documentation
Add swift-format documentation
2016-08-12 07:32:20 -07:00
Daniel Martín
14741c40bc Add swift-format documentation
Also, rename some options to improve consistency across the rest of the
driver options.
2016-08-10 17:43:49 +02:00
Daniel Martín
6902d9220c Use UINT_MAX instead of a "magic" upper bound
If a line range is not set, create a line range over the unsigned type,
instead of setting an arbitrary limit. We're not probably going to ever
deal with such big files, though.
2016-08-10 13:08:18 +02:00
Daniel Martín
df15ec4f3b Swift-format driver tool
This driver tool formats Swift files or file ranges using some
parameters like tabs or spaces, tab width, or amount of spaces.
2016-08-08 11:07:15 +02:00