summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format/clang-format.py
Commit message (Collapse)AuthorAgeFilesLines
* clang-format: Enable #include sorting by default.Daniel Jasper2015-11-161-1/+1
| | | | | | | | | 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
* clang-format: Add initial #include sorting capabilities.Daniel Jasper2015-09-231-1/+1
| | | | | | | | | 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
* 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
* 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: 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
* 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
* clang-format: Fix vim-integration for empty files.Daniel Jasper2014-05-221-1/+6
| | | | | | Discovered by Ahmed Charles in http://reviews.llvm.org/D3018. llvm-svn: 209417
* clang-format.py: Don't omit the first two words from error messages.Nico Weber2014-04-171-6/+1
| | | | | | | | This reverts r172072. clang-format used to use DiagnosticEngine to output errors: http://llvm.org/viewvc/llvm-project?view=revision&revision=172071. Now it doesn't, so this code is obsolete. llvm-svn: 206479
* Add a main function to the clang-format.py vim integration.Ahmed Charles2014-03-101-40/+43
| | | | | | This will allow using an early return statement in a subsequent change. llvm-svn: 203501
* clang-format.py: Make formatting unnamed buffers work again (broke in r190691).Nico Weber2013-10-251-3/+4
| | | | llvm-svn: 193433
* clang-format: Add -assume-filename option for editor integrations.Daniel Jasper2013-09-131-1/+2
| | | | | | | | | | | | | | With -style=file, clang-format now starts to search for a .clang-format file starting at the file given with -assume-filename if it reads from stdin. Otherwise, it would start searching from the current directory, which is not helpful for editor integrations. Also changed vim, emacs and sublime integrations to actually make use of this flag. This fixes llvm.org/PR17072. llvm-svn: 190691
* Allow _clang-format as alternative to .clang-format config filenameHans Wennborg2013-09-101-1/+2
| | | | | | | | | | | Dotfiles are impractical on Windows. This makes clang-format search for the style configuration file as '_clang-format' in addition to the usual '.clang-format'. This is similar to how VIM searches for '_vimrc' on Windows. Differential Revision: http://llvm-reviews.chandlerc.com/D1629 llvm-svn: 190413
* Switch the default mode for clang-format to '-file'. Make 'LLVM' theChandler Carruth2013-09-021-3/+4
| | | | | | | | | | | | | | | | | | | fallback syntax used when we fail to find a '.clang-format' file. Adjust variable names appropriately. Update the editor integration pieces that specify a '-style' option to specify it as '-style=file'. I left the functionality in place because even if the preferred method is to use '.clang-format' files, this way if someone needs to clobber the style in their editor we show how to do so in these examples. Also check in a '.clang-format' file for Clang to ensure that separate checkouts and builds of Clang from LLVM can still get the nice formatting. =] This unfortunately required nuking the test for the absence of a '.clang-format' file as now the directory happening to be under your clang source tree will cause there to always be a file. ;] llvm-svn: 189741
* Fix bug in clang-format's vim integration cause by r186789.Daniel Jasper2013-07-221-1/+1
| | | | | | | | After the first operation, the buffer contents has changed and thus all other operations would be invalid. Executing the operations in reversed order should fix this. llvm-svn: 186840
* clang-format: Smarter replacement in the vim integration.Daniel Jasper2013-07-211-7/+6
| | | | | | | | | With this fix, only changed regions will be replaced in vim's buffer. Thereby, marks should mostly be left intact. Furthermore, this is a better fix for the performance problem in conjunction with 'foldmethod=syntax' (see r186660). llvm-svn: 186789
* Use -lines option instead of -offset/-length. This fixes problems with files ↵Alexander Kornienko2013-07-201-6/+3
| | | | | | using dos newlines (<CR><LF>). llvm-svn: 186740
* Improve clang-format vim integration.Daniel Jasper2013-07-191-2/+2
| | | | | | | | The previous line-by-line replacement causes vim to take a long time if the foldmethod is set to 'syntax'. This should significantly improve performance in that case. llvm-svn: 186660
* [clang-format] Don't flash an ugly cmd prompt in Vim on WindowsReid Kleckner2013-06-101-1/+9
| | | | | | | | Reviewers: klimek Differential Revision: http://llvm-reviews.chandlerc.com/D941 llvm-svn: 183654
* Let clang-format move the cursor appropriately.Daniel Jasper2013-05-211-9/+15
| | | | | | | | | With this patch, clang-format will try to keep the cursor at the original code position in editor integrations (implemented for emacs and vim). This means, after formatting, clang-format will try to keep the cursor on the same character of the same token. llvm-svn: 182373
* Improvements to clang-format integrations.Daniel Jasper2013-04-091-1/+6
| | | | | | | | This adds an emacs editor integration (thanks to Ami Fischman). Also pulls out the style into a variable for the vi integration and just uses clang-formats defaults style in clang-format-diff.py. llvm-svn: 179098
* Add clang-format binary to cfe.Daniel Jasper2013-03-201-0/+60
llvm-svn: 177506
OpenPOWER on IntegriCloud