Commit Graph

28 Commits

Author SHA1 Message Date
Daniel Jasper d1a6659263 Remove superseeded option.
The -invert-pointer-binding option will be superseeded by my next
cfe-commit. Instead of explicitly overwriting this flag, clang-format
can then be configured to auto-detect certain style-options based on the
input file.

llvm-svn: 174503
2013-02-06 14:22:17 +00:00
Manuel Klimek 5e5e1c3b80 Add xml:space='preserve' in order to correctly preserve whitespace.
llvm-svn: 174502
2013-02-06 12:40:01 +00:00
Manuel Klimek 1882ad9905 Kick JSON output for XML output.
Apparently the owners of the tools we want to integrate with (eclipse in
this case) don't have JSON parsers.

The output now is:
<replacements>
<replacement offset='2' length='3'>  </replacement>
...
</replacements>

Kicking JSON for now - it's easy enough to get back in when we need it.

FIXME: once we find this useful enough, we might want to add it as
free-standing functions to tooling.

llvm-svn: 174497
2013-02-06 09:42:05 +00:00
Manuel Klimek 65bdeae121 Adds JSON output for replacements, to simplify tools integration.
Using -output-replacements will now output the replacements instead
of the changed code. This allows easier integration with tools that
need full control over what changed.

The format is an array of objects with the members "offset" (number),
"length" (number) and "replacement_text" (string), for example:

[
  {
    "offset": 42,
    "length": 5,
    "replacement_text": "  "
  },
  {
    "offset": 105,
    "length": 4,
    "replacement_text": ""
  }
]

llvm-svn: 174382
2013-02-05 15:52:21 +00:00
Manuel Klimek 8c651f0974 Implements support for specifying multiple ranges.
This is backwards compatible with earlier integrations.
Also adds a basic test and a test for the ranges integration.

You can now run:
clang-format -offset=42 -length=15 -offset=150 -length=22
To re-format the ranges (42, +15) and (150, +22).

llvm-svn: 174378
2013-02-05 15:25:34 +00:00
Daniel Jasper 21cdc848f4 Don't touch unchanged file for in-place edit.
This fixes llvm.org/PR15087.

llvm-svn: 173919
2013-01-30 09:52:38 +00:00
Chris Lattner 28b00bffd2 these need the bitcode reader as well.
llvm-svn: 172908
2013-01-19 18:45:35 +00:00
NAKAMURA Takumi 40ac112c91 Introduce llvm::sys::PrintStackTraceOnErrorSignal()
llvm-svn: 172821
2013-01-18 14:31:00 +00:00
Daniel Jasper 9f4a1c6184 Add temporary option to invert the */& binding in a specific style.
This is temporarily necessary until styles are configurable through files
as it seems to be a contentious issue.

llvm-svn: 172546
2013-01-15 18:56:19 +00:00
Daniel Jasper 51ce63cd98 Add support for Chromium style.
llvm-svn: 172432
2013-01-14 16:26:38 +00:00
Alexander Kornienko 79f49456fa Fix: correct file name in diagnostics.
llvm-svn: 172405
2013-01-14 13:40:44 +00:00
Nico Weber e5d643d21c Remove FIXME fixed by djasper in r172066.
llvm-svn: 172097
2013-01-10 19:48:53 +00:00
Alexander Kornienko 92465285ab Format what you can when errors are found
llvm-svn: 172075
2013-01-10 15:19:44 +00:00
Alexander Kornienko 5b64279192 Improved clang-format integration support for diagnostic messages output
llvm-svn: 172072
2013-01-10 15:06:57 +00:00
Daniel Jasper 494394d817 Let clang-format binary use same LangOpts as test.
llvm-svn: 172066
2013-01-10 13:09:09 +00:00
Alex Rosenberg 0b18a095cf Fix comment
llvm-svn: 172042
2013-01-10 04:12:06 +00:00
Daniel Jasper abf4cce40f Simplify reversed for-loop.
llvm-svn: 171998
2013-01-09 20:46:42 +00:00
Daniel Jasper 46e432fb8a Initial version of diff/patch-reformat tool.
Use at your own risk :-).

llvm-svn: 171994
2013-01-09 20:20:11 +00:00
Manuel Klimek 3a449891ba Implements the features requested in PR14679.
- adds '-h' as an alias for '-help'.
- adds an optional <file> argument
- adds an option -i to in-place edit the given file
- adds a help text to explain what the tool does

llvm-svn: 171858
2013-01-08 15:19:57 +00:00
Nico Weber 48e75f7e48 Enabled ObjC2 in clang-format for @package. Matches r171766.
llvm-svn: 171767
2013-01-07 19:08:19 +00:00
Nico Weber d9a440d21f Set LangOpts.ObjC1 to 1 in clang-format.
This matches the test change done in clang at r171742. Without this,
clang-format would strip '@' characters and format e.g. '@interface' as
'interface'.

llvm-svn: 171743
2013-01-07 15:21:13 +00:00
Daniel Jasper f7b48b6342 Make clang-format binary understand C++11.
llvm-svn: 171736
2013-01-07 14:52:14 +00:00
Daniel Jasper f0273f8e15 Handle segfaults in clang-format vim-integration.
A segfault used to clear the entire buffer. With this change, a message
to report a bug is displayed instead.

This should solve most cases similar to llvm.org/PR14774.

llvm-svn: 171480
2013-01-04 18:24:12 +00:00
Chandler Carruth 54e147a933 Fix the sorting of the #include lines in these tools.
This is done with the script in llvm/utils/sort_includes.py

llvm-svn: 171365
2013-01-02 10:29:31 +00:00
Chandler Carruth 5826f96e51 Teach the extras repository to actually install the clang-format tool.
We should also install the clang-format.py script somewhere that makes
since for a Vim integration script. I don't know where that is though,
so just installing the binary for now. This is enough to let me use the
script from a checkout combined with the installed (and thus less likely
to crash or be slow) clang-format binary.

llvm-svn: 171164
2012-12-27 17:48:37 +00:00
Daniel Jasper 79e68bcf0e Basic clang-format vim-integration.
File contains installation and usage instructions.

llvm-svn: 169421
2012-12-05 21:06:08 +00:00
Daniel Jasper 95b089e287 Fix make build (hopefully).
llvm-svn: 169371
2012-12-05 10:22:07 +00:00
Daniel Jasper ff1491322e First version of a command line clang-format tool.
Reads a single source range (offset, length) as well as the style guide
as parameters and then reformats everything it receives from stdin.

llvm-svn: 169364
2012-12-05 09:01:09 +00:00