summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* clang-format: [JS] Support regex literals with trailing escaped slash.Daniel Jasper2014-09-091-4/+1
| | | | | | | | | | | | | | | | | | Before: var regex = / a\//; int i; After: var regex = /a\//; int i; This required pushing the Lexer into its wrapper class and generating a new one in this specific case. Otherwise, the sequence get lexed as a //-comment. This is hacky, but I don't know a better way (short of supporting regex literals in the Lexer). Pushing the Lexer down seems to make all the call sites simpler. llvm-svn: 217444
* clang-format: [JS] Support alternative operator names as identifiers.Daniel Jasper2014-09-041-1/+1
| | | | | | | | | | Before: not. and . or . not_eq = 1; After: not.and.or.not_eq = 1; llvm-svn: 217179
* Use /usr/bin/env python instead of /usr/bin/python.Ed Schouten2014-09-022-2/+2
| | | | | | | | On operating systems like the BSDs, it is typically the case that /usr/bin/python does not exist. We should therefore use /usr/bin/env instead. This is also done in various other scripts in tools/. llvm-svn: 216945
* Make clang's rewrite engine a core featureAlp Toker2014-07-162-2/+2
| | | | | | | | | | | | | | | The rewrite facility's footprint is small so it's not worth going to these lengths to support disabling at configure time, particularly since key compiler features now depend on it. Meanwhile the Objective-C rewriters have been moved under the ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still potentially worth excluding from lightweight builds. Tests are now passing with any combination of feature flags. The flags historically haven't been tested by LLVM's build servers so caveat emptor. llvm-svn: 213171
* Update for llvm api change.Rafael Espindola2014-07-061-3/+5
| | | | llvm-svn: 212408
* Remove 'const' from MemoryBuffers used through the SourceManagerDavid Blaikie2014-06-271-1/+1
| | | | | | | | | | | | | | This removes a const_cast added in r211884 that occurred due to an inconsistency in how MemoryBuffers are handled between some parts of clang and LLVM. MemoryBuffers are immutable and the general convention in the LLVM project is to omit const from immutable types as it's simply redundant/verbose (see llvm::Type, for example). While this change doesn't remove "const" from /every/ MemoryBuffer, it at least makes this chain of ownership/usage consistent. llvm-svn: 211915
* Refer to error_code with the std prefix.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210817
* clang-format: Introduce DisableFormat that prevents formatting.Daniel Jasper2014-05-221-1/+2
| | | | | | | | | | | | | | | | | And "none" pseudo-style indicating that formatting should be not applied. (1) Using .clang-format with "DisableFormat: true" effectively prevents formatting for all files within the folder containing such .clang-format file. (2) Using -fallback-style=none together with -style=file prevents formatting when .clang-format is not found, which can be used in on-save callback. Patch by Adam Strzelecki. Thank you! llvm-svn: 209446
* 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: Add clang-format-diff usage examples for SVN.Daniel Jasper2014-05-141-1/+2
| | | | llvm-svn: 208766
* Enable alternative tokens by default for clang-format.Nikola Smiljanic2014-05-081-2/+2
| | | | | | Patch by Bobby Moretti. llvm-svn: 208269
* 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
* clang-format: Add proto files and JavaScript to git-clang-format.Daniel Jasper2014-04-091-0/+3
| | | | llvm-svn: 205842
* 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
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-1/+1
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Add newlines to fallback-style description. Patch by Kamal Essoufi\!Alexander Kornienko2014-02-261-3/+4
| | | | llvm-svn: 202269
* Make the OptionCategory variable static.Alexander Kornienko2014-02-051-1/+1
| | | | llvm-svn: 200839
OpenPOWER on IntegriCloud