summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format/clang-format-diff.py
Commit message (Collapse)AuthorAgeFilesLines
* [clang-format] [PR36858] Add missing .hh and .cs extensions from python ↵Paul Hoad2019-09-241-2/+2
| | | | | | | | | | | | | | | | | | support utilities Summary: https://bugs.llvm.org/show_bug.cgi?id=36858 identifies .hh as a missing C++ header extension file while making this change I realized there was no support for .cs files which were added recently Reviewers: pseyfert, klimek, owenpan Reviewed By: klimek Subscribers: cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D67949 llvm-svn: 372760
* Improve clang-format-diff help outputNico Weber2019-07-231-8/+4
| | | | | | | | | The description in clang-format-diff.py is more useful than the one in `clang-format-diff -h`, so use the same description in both places. Differential Revision: https://reviews.llvm.org/D64998 llvm-svn: 366828
* [tools] Fix python DeprecationWarning: invalid escape sequenceSerge Guelton2019-02-111-2/+2
| | | | | | | | | | | | | | | | | | | The python documentation says "it’s highly recommended that you use raw strings for all but the simplest expressions." (https://docs.python.org/3/library/re.html) So do that with the attached patch generated by sed -i -e "s/re.search('/re.search(r'/g" $(git grep -l 're.search(') The warning can be seen in e.g. python3.7: $ python3.7 -Wd >>> import re; re.search('\s', '') <stdin>:1: DeprecationWarning: invalid escape sequence \s Commited on behalf of Marco Falke. Differential Revision: https://reviews.llvm.org/D57528 llvm-svn: 353707
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Portable Python script across Python versionSerge Guelton2019-01-031-4/+5
| | | | | | | | StringIO is obsoleted in Python3, replaced by io.BytesIO or io.StringIO depending on the use. Differential Revision: https://reviews.llvm.org/D55196 llvm-svn: 350318
* Portable Python script across Python versionSerge Guelton2018-12-181-1/+1
| | | | | | | | Make scripts more future-proof by importing most __future__ stuff. Differential Revision: https://reviews.llvm.org/D55208 llvm-svn: 349504
* Portable Python script across Python versionSerge Guelton2018-12-181-0/+1
| | | | | | | | Using from __future__ import print_function it is possible to have a compatible behavior of `print(...)` across Python version. Differential Revision: https://reviews.llvm.org/D55213 llvm-svn: 349454
* clang-format-diff: Make it work with python3 tooKrasimir Georgiev2018-08-031-10/+15
| | | | | | | | | | | | | | | | Summary: It is not necessary, but would be nice if the script run on python3 as well (as opposed to only python2, which is going to be deprecated https://pythonclock.org/) Contributed by MarcoFalke! Reviewers: krasimir Reviewed By: krasimir Subscribers: lebedev.ri, sammccall, cfe-commits Differential Revision: https://reviews.llvm.org/D48098 llvm-svn: 338839
* Add the --no-color option to the git call in the doc when using ↵Sylvestre Ledru2016-12-031-1/+1
| | | | | | clang-format-diff llvm-svn: 288605
* 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: Add include sorting capabilities to sublime, emacs andDaniel Jasper2015-10-071-0/+4
| | | | | | clang-format-diff.py. llvm-svn: 249567
* clang-format: Recognize the .ts (TypeScript) extension as JavaScript.Daniel Jasper2015-03-111-1/+1
| | | | | | Patch by Martin Probst. Thank you. llvm-svn: 231926
* 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
* Use /usr/bin/env python instead of /usr/bin/python.Ed Schouten2014-09-021-1/+1
| | | | | | | | 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
* clang-format: Add clang-format-diff usage examples for SVN.Daniel Jasper2014-05-141-1/+2
| | | | llvm-svn: 208766
* clang-format: Enable formatting for .proto and .protodevel files.Daniel Jasper2014-01-211-1/+2
| | | | | | Support for protocol buffer files seems complete enough. llvm-svn: 199750
* Fix usage description of clang-format-diff.py.Daniel Jasper2013-12-191-2/+2
| | | | llvm-svn: 197668
* clang-format-diff.py: fix -regex/-iregex matchingAlp Toker2013-12-181-4/+4
| | | | | | | | | | While debating the finer points of file extension matching, we somehow missed the bigger problem that the current code will match anything starting with the default or user-specified pattern (e.g. lit.site.cfg.in). Fix this by doing what find(1) does, implicitly wrapping the pattern with ^$. llvm-svn: 197608
* clang-format-diff.py: add the OpenCL file extensionAlp Toker2013-12-181-1/+1
| | | | | | It's handled correctly as a C-family language. llvm-svn: 197542
* Added -iregex for case-insensitive regex to filter file names.Alexander Kornienko2013-12-161-5/+13
| | | | | | | | | | | | | | | | | Summary: -regex and -iregex both mimic options of the find utility. Made the default list of extensions case-insensitive, so that it's not only C and CPP extensions are accepted in upper case. Reviewers: djasper Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2415 llvm-svn: 197378
* clang-format-diff.py: Support -regex filter and more filename extensionsAlp Toker2013-12-101-4/+5
| | | | | | | | | | | | | Add support for more filename extensions based on the list in the clang plus JavaScript. Also adds a -regex option so users can override defaults if they have unusual file extensions or want to format everything in the diff. Keeping with tradition the flag is modelled on Unix conventions, this time matching the semantics of find(1). llvm-svn: 196917
* clang-format-diff.py: pass through errors to stderr, not stdoutAlp Toker2013-12-051-5/+2
| | | | | | | Also use write() for unified diff output to avoid further processing by the print function (e.g. trailing newline). llvm-svn: 196484
* clang-format-diff.py: Fix 'beintroduced' in help outputAlp Toker2013-12-041-1/+1
| | | | | | Also update docs to reflect recently changed -i inplace edit behaviour. llvm-svn: 196336
* Changed clang-format-diff.py to output diff by default. Added -i option to ↵Alexander Kornienko2013-10-111-3/+22
| | | | | | | | | | | | | | | | | | | | | | apply changes to files instead. Summary: "svn diff|clang-format-diff.py" will just output the diff. Now it's possible to use: svn diff|clang-format-diff.py|patch -p0 as an equivalent to: svn diff|clang-format-diff.py -i ;) Reviewers: djasper Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1840 llvm-svn: 192505
* clang-format: Don't exit with failure on empty files.Daniel Jasper2013-10-081-1/+2
| | | | | | | | | | Also let clang-format-diff.py detect errors based on clang-format's return code. Otherwise messages like "Can't find usable .clang-format, falling back to LLVM style" can make it fail, which might be undesired. Patch by Alp Toker. Thank you! llvm-svn: 192184
* clang-format: Fix clang-format-diff.py according to diff specification.Daniel Jasper2013-10-021-2/+5
| | | | | | | | | | | | | | | | | | | | | Patch by Alp Toker. Many thanks! Original descriptions: clang-format-diff incorrectly modifies unchanged lines due to an error in diff parsing. The unified diff format has a default line change count of 1, and 0 may be specified to indicate that no lines have been added. This patch updates the parser to accurately reflect the diff specification. This also has the benefit of stabilising the operation so it will produce the same output when run multiple times on the same changeset, which was previously not the case. No tests added because this script is not currently tested (though we should look into that!) llvm-svn: 191820
* Fix clang-format-diff.py to accept -style again.Daniel Jasper2013-09-211-1/+1
| | | | | | Copy and paste error in r190935.. llvm-svn: 191137
* Simplify clang-format-diff.py using new clang-format options.Daniel Jasper2013-09-181-59/+26
| | | | | | clang-format's -lines parameter makes this significantly easier. llvm-svn: 190935
* Added WebKit style to the BasedOnStyle handling and to the relevant help ↵Alexander Kornienko2013-09-021-3/+5
| | | | | | messages. llvm-svn: 189765
* Fix default value of clang-format-diff's -p option.Daniel Jasper2013-05-301-1/+1
| | | | | | | This way, it has the same default as 'patch' and also the example in the code makes more sense as it is explicitly setting -p 1. llvm-svn: 182923
* Small improvements to clang-format documentation and integrationDaniel Jasper2013-04-171-1/+2
| | | | | | scripts. llvm-svn: 179676
* Fix clang-format-diff.py script.Daniel Jasper2013-04-121-1/+1
| | | | llvm-svn: 179377
* Improvements to clang-format integrations.Daniel Jasper2013-04-091-5/+5
| | | | | | | | 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/+115
llvm-svn: 177506
OpenPOWER on IntegriCloud