summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format
Commit message (Collapse)AuthorAgeFilesLines
...
* [CMake] Add install-clang-format target by migrating to add_clang_toolChris Bieneman2016-02-231-8/+19
| | | | | | This change migrates clang-format to add_clang_tool which makes a component-based install target. To support component-based installation the extra installed scripts all need to have the "clang-format" component too. llvm-svn: 261680
* Remove autoconf supportChris Bieneman2016-01-261-22/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* clang-format-diff: Replace hard-code default for clang-format binary with flag.Daniel Jasper2016-01-201-9/+6
| | | | | | Patch by Kwasi Mensah, thank you. llvm-svn: 258328
* clang-format: Make moving of the Cursor work properly when sorting #includes.Daniel Jasper2015-11-231-34/+33
| | | | llvm-svn: 253860
* clang-format: Enable #include sorting by default.Daniel Jasper2015-11-164-17/+15
| | | | | | | | | This has seen quite some usage and I am not aware of any issues. Also add a style option to enable/disable include sorting. The existing command line flag can from now on be used to override whatever is set in the style. llvm-svn: 253202
* Update list of languages advertised in OVERVIEW: A tool to format ↵Nico Weber2015-10-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C/C++/Java/JavaScript/Objective-C/Protobuf code. If no arguments are specified, it formats the code from standard input and writes the result to the standard output. If <file>s are given, it reformats the files. If -i is specified together with <file>s, the files are edited in-place. Otherwise, the result is written to the standard output. USAGE: clang-format [options] [<file> ...] OPTIONS: -assume-filename=<string> - When reading from stdin, clang-format assumes this filename to look for a style config file (with -style=file) and to determine the language. -cursor=<uint> - The position of the cursor when invoking clang-format from an editor integration -dump-config - Dump configuration options to stdout and exit. Can be used with -style option. -fallback-style=<string> - The name of the predefined style used as a fallback in case clang-format is invoked with -style=file, but can not find the .clang-format file to use. Use -fallback-style=none to skip formatting. -help - Display available options (-help-hidden for more) -i - Inplace edit <file>s, if specified. -length=<uint> - Format a range of this length (in bytes). Multiple ranges can be formatted by specifying several -offset and -length pairs. When only a single -offset is specified without -length, clang-format will format up to the end of the file. Can only be used with one input file. -lines=<string> - <start line>:<end line> - format a range of lines (both 1-based). Multiple ranges can be formatted by specifying several -lines arguments. Can't be used with -offset and -length. Can only be used with one input file. -offset=<uint> - Format a range starting at this byte offset. Multiple ranges can be formatted by specifying several -offset and -length pairs. Can only be used with one input file. -output-replacements-xml - Output replacements as XML. -sort-includes - Sort touched include lines -style=<string> - Coding style, currently supports: LLVM, Google, Chromium, Mozilla, WebKit. Use -style=file to load style configuration from .clang-format file located in one of the parent directories of the source file (or current directory for stdin). Use -style="{key: value, ...}" to set specific parameters, e.g.: -style="{BasedOnStyle: llvm, IndentWidth: 8}" -version - Display the version of this program output. llvm-svn: 250671
* clang-format: Basic escaping when outputting XML.Daniel Jasper2015-10-151-1/+9
| | | | llvm-svn: 250440
* clang-format: Add include sorting capabilities to sublime, emacs andDaniel Jasper2015-10-073-1/+6
| | | | | | clang-format-diff.py. llvm-svn: 249567
* [VFS] Transition clang-format to use an in-memory FS.Benjamin Kramer2015-10-061-9/+15
| | | | | | | | | | | Apart from being cleaner this also means that clang-format no longer has access to the host file system. This isn't necessary because clang-format never reads includes :) Includes minor tweaks and bugfixes found in the VFS implementation while running clang-format tests. llvm-svn: 249385
* [libFuzzer] make LLVMFuzzerTestOneInput (the fuzzer target function) return ↵Kostya Serebryany2015-10-021-1/+2
| | | | | | int instead of void. (following llvm r249214) llvm-svn: 249215
* clang-format: Add clangRewrite dependency to fix cmake build.Daniel Jasper2015-09-301-0/+1
| | | | llvm-svn: 248929
* clang-format: Use Rewriter again to write the output files.Daniel Jasper2015-09-301-18/+18
| | | | | | | | This has two advantages: 1. Atomic writes. 2. Proper handling of line endings (hopefully solving llvm.org/PR24999 llvm-svn: 248904
* clang-format: Extend #include sorting functionalityDaniel Jasper2015-09-291-5/+5
| | | | | | | | | Recognize the main module header as well as different #include categories. This should now mimic the behavior of llvm/utils/sort_includes.py as well as clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp very closely. llvm-svn: 248782
* clang-format: Add initial #include sorting capabilities.Daniel Jasper2015-09-233-33/+60
| | | | | | | | | To implement this nicely, add a function that merges two sets of replacements that are meant to be done in sequence. This functionality will also be useful for other applications, e.g. formatting the result of clang-tidy fixes. llvm-svn: 248367
* clang-format: Extend vim integration so that a line range can be passed in.Daniel Jasper2015-07-111-2/+16
| | | | llvm-svn: 241976
* clang-format: Add TypeScript detection to git-clang-format.Daniel Jasper2015-06-191-0/+1
| | | | llvm-svn: 240128
* Fix terrible python goof in clang-format.py which broke my vimChandler Carruth2015-06-041-1/+1
| | | | | | | | | integration. Nothing is more important in life than clang-format integration with vim. ;] llvm-svn: 239098
* Make vim also output a helpful message in some error cases.Manuel Klimek2015-06-021-0/+2
| | | | | | | | When clang-format encounters a syntax error, it will not format that line; we're now using the same mechanism we're already using in emacs to show a helpful error message to the user. llvm-svn: 238823
* revert r237081 -- bad idea (-lcrypt may not be present)Kostya Serebryany2015-05-121-1/+0
| | | | llvm-svn: 237086
* add -lcrypto to clang and clang-format fuzzers (lib/Fuzzer will soon require it)Kostya Serebryany2015-05-121-0/+1
| | | | llvm-svn: 237081
* Reapply r236854 and fixed r236867.Daniel Jasper2015-05-102-10/+21
| | | | | | | Makes emacs show a different message when clang-format encountered a syntax error. llvm-svn: 236943
* Revert "Make emacs show when clang-format encountered a syntax error."Tobias Grosser2015-05-082-22/+11
| | | | | | | | | | | This reverts commit 236854, which caused clang-format to always print '{ "IncompleteFormat": false }' at the top of an incompletely formatted file. This output causes problems e.g. in Polly's automatic formatting checks. Daniel tried to fix this in 236867, but this fix had to be reverted due to buildbot failures. I revert this change as well for now as it is Friday night and unlikely to be fixed immediately. llvm-svn: 236908
* Revert "clang-format: Only output IncompleteFormat if -cursor is given."Renato Golin2015-05-081-6/+6
| | | | | | | This reverts commit r236867, as it was breaking multiple buildbots. Daniel will look into it later. llvm-svn: 236882
* clang-format: Only output IncompleteFormat if -cursor is given.Daniel Jasper2015-05-081-6/+6
| | | | | | This is only for editor integrations. llvm-svn: 236867
* Make emacs show when clang-format encountered a syntax error.Manuel Klimek2015-05-082-11/+22
| | | | | | | Propagate the 'incomplete-format' state back through clang-format's command line interace and adapt the emacs integration to show a better result. llvm-svn: 236854
* fix clang-fuzzer and clang-format-fuzzer Kostya Serebryany2015-05-071-1/+1
| | | | llvm-svn: 236691
* clang-format: Don't allow -i when reading from stdin.Daniel Jasper2015-05-061-1/+3
| | | | llvm-svn: 236592
* clang-format: Add default fallback style.Daniel Jasper2015-04-171-0/+1
| | | | | | Thanks to Michael Schlottke. llvm-svn: 235162
* clang-format: add an option for fallback style in vimrcDaniel Jasper2015-04-161-0/+4
| | | | | | | | | | | | With this patch, clang-format.py will search and use existing .clang-format file if there is one and fallback to the specific format style if not. It should cover the projects which don't have .clang-format files in their source. As the option fallback-style is available in clang 3.5 or later, it is safe to use. Patch by "Chilledheart" (http://reviews.llvm.org/D8489). llvm-svn: 235080
* clang-format: Recognize the .ts (TypeScript) extension as JavaScript.Daniel Jasper2015-03-111-1/+1
| | | | | | Patch by Martin Probst. Thank you. llvm-svn: 231926
* Reverting r227453, which adds back the fuzzer library. Now excluding the ↵Aaron Ballman2015-01-293-1/+45
| | | | | | clang-format fuzzer functionality based on LLVM_USE_SANITIZE_COVERAGE being set or unset. llvm-svn: 227465
* Temporarily reverting the fuzzer library as it causes too many build issues ↵Aaron Ballman2015-01-293-43/+1
| | | | | | for MSVC users. This reverts: 227354 llvm-svn: 227453
* Add clang-format-fuzzer targetKostya Serebryany2015-01-283-1/+43
| | | | | | | | | | | | | | | | | | | | | Summary: This adds clang-format-fuzzer binary, which depends on the Fuzzer lib, see http://reviews.llvm.org/D7184 This fuzer has found ~15 bugs so far, and I hope to set up a bot for it. Test Plan: run on a bot. Reviewers: samsonov, djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D7202 llvm-svn: 227354
* Adopt new cl::HideUnrelatedOptions API added r226729.Chris Bieneman2015-01-211-9/+1
| | | | | | | | | | | | Summary: cl::HideUnrelatedOptions allows tools to hide all options not part of a specific OptionCategory. This is the common use case for cl::getRegisteredOptions, which should be deprecated in the future because it exposes implementation details of command line parsing. Reviewers: dexonsmith Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D7109 llvm-svn: 226741
* Make clang-format work in emacs buffers with unicode characters.Manuel Klimek2015-01-191-11/+16
| | | | | | | | | | Emacs functions by default use character positions; convert characters to offsets when handing parameters to clang-format and convert byte offsets we get from clang-format back to character positions. Reworked the code a bit so the 0-based to 1-based offset calculations are done in the same place where we do the multi-byte to offset mapping. llvm-svn: 226445
* Update clang-format.el to use xml output and patch in the returned chunks.Manuel Klimek2015-01-131-46/+86
| | | | | | | | | This leads to better undo behavior and avoids window content jumping around. Patch by Johann Klähn. llvm-svn: 225777
* Add the shifted cursor position to XML output, so it can be used by editor ↵Manuel Klimek2015-01-091-0/+4
| | | | | | integrations. llvm-svn: 225516
* Improve clang-format.el.Manuel Klimek2015-01-081-48/+117
| | | | | | | | | | | | - includes header/footer as required by MELPA - correctly handles buffers that are not associated with a file - displays stderr and exit code of clang-format process - customizable via the emacs customization interface and file-/directory- local variables Patch by Johann Klähn. llvm-svn: 225447
* clang-format: Make clang-format-diff.py format java files.Daniel Jasper2014-12-081-1/+1
| | | | llvm-svn: 223685
* clang-format: Give clang-format-diff.py a -v option.Daniel Jasper2014-11-141-0/+4
| | | | | | | With it, it prints the file being formatted. Apparently people are formatting thousands of files and some progress indication is helpful. llvm-svn: 221990
* clang-format: Document that --assume-filename affects the language.Nico Weber2014-11-101-1/+1
| | | | llvm-svn: 221606
* clang-format: Make it possible to (require 'clang-format)Justin Bogner2014-11-051-0/+2
| | | | | | | This makes the emacs integration ``provide`` a clang-format feature, so that a .emacs can ``require`` it. llvm-svn: 221330
* clang-format: Fix vim integration if g:clang_format_binary doesn't existDaniel Jasper2014-11-041-1/+1
| | | | llvm-svn: 221254
* clang-format: permit setting the path to clang in vimrcSaleem Abdulrasool2014-11-021-0/+3
| | | | | | | | | If g:clang_format_path is set in the vimrc, that path will take precedence over the hard coded path (which is reliant on the PATH environment variable). This provides an easy mechanism for switching the selected clang-format binary during development. llvm-svn: 221108
* docs: remove double carriage-returnSaleem Abdulrasool2014-11-021-1/+1
| | | | | | | The double carriage return would silence a warning due to a missing .clang-format. Permit the error to bubble through. llvm-svn: 221107
* [CMake] Prune redundant libdeps.NAKAMURA Takumi2014-10-301-1/+0
| | | | llvm-svn: 220893
* [CMake] Add dependencies on clangToolingCore.NAKAMURA Takumi2014-10-301-0/+1
| | | | llvm-svn: 220890
* clang-format: Cut more clangAST dependencies.Daniel Jasper2014-10-291-0/+1
| | | | | | Hopefully fixing windows builds. llvm-svn: 220878
* Refactor libTooling to reduce required dependencies.Daniel Jasper2014-10-292-4/+1
| | | | | | | | | | This moves classes for storing and applying replacements to separate files. These classes specifically are used by clang-format which doesn't have any other dependencies on clangAST. Thereby, the size of clang-format's binary can be cut roughly in half and its build time sped up. llvm-svn: 220867
* clang-format: improve vim integration docsSaleem Abdulrasool2014-10-271-2/+2
| | | | | | | | | | Improve the documentation for vim integration of clang-format. Prefer the use of <c-o> to do the normal mode command execution to avoid side-effects of the escape and re-insertion (cursor movement). Tweak the macros to use a double return to avoid having to manually return control to the editor from the subprocess. llvm-svn: 220685
OpenPOWER on IntegriCloud