Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4 |
|
#
625841c3 |
| 21-Aug-2024 |
magic-akari <akari.ccino@gmail.com> |
[clang-format] Use double hyphen for multiple-letter flags (#100978)
- Closes: #100974
|
Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5 |
|
#
dd3c26a0 |
| 17-May-2023 |
Tobias Hieta <tobias@hieta.se> |
[NFC][Py Reformat] Reformat python files in clang and clang-tools-extra
This is an ongoing series of commits that are reformatting our Python code.
Reformatting is done with `black`.
If you end up
[NFC][Py Reformat] Reformat python files in clang and clang-tools-extra
This is an ongoing series of commits that are reformatting our Python code.
Reformatting is done with `black`.
If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run git checkout --ours <yourfile> and then reformat it with black.
If you run into any problems, post to discourse about it and we will try to help.
RFC Thread below:
https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D150761
show more ...
|
Revision tags: llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6 |
|
#
86278114 |
| 21-Nov-2022 |
Ji, Jinsong <jinsong.ji@intel.com> |
[clang-format] Support new file formatting with vim
The vim Formatonsave integration is not working if we create a new file directly using vim. eg: vi -V9t.log t.cpp
It will not able to format the
[clang-format] Support new file formatting with vim
The vim Formatonsave integration is not working if we create a new file directly using vim. eg: vi -V9t.log t.cpp
It will not able to format the buffer.
> Traceback (most recent call last): > File "<string>", line 1, in <module> > File "...clang/tools/clang-format/clang-format.py", line 156, in <module> > main() > File "...clang/tools/clang-format/clang-format.py", line 80, in main > with open(vim.current.buffer.name, 'r') as f: > FileNotFoundError: [Errno 2] No such file or directory: '...t.cpp'
This patch check the file before we try to open it.
Reviewed By: owenpan
Differential Revision: https://reviews.llvm.org/D138234
show more ...
|
Revision tags: llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1 |
|
#
8f4e6cfe |
| 05-Sep-2022 |
Amy Wang <kai.ting.wang@huawei.com> |
[clang-format] Use utf-8 for JSON object load
From Python 3.6 and above, it should be able to automatically select a decoding for json.loads. However, with a vim encoding that defaults to utf-8, cla
[clang-format] Use utf-8 for JSON object load
From Python 3.6 and above, it should be able to automatically select a decoding for json.loads. However, with a vim encoding that defaults to utf-8, clang-format.py runs into the following error
TypeError: the JSON object must be str, not 'bytes'
This patch explicitly specifies utf-8 decoding for the header.
Reviewed by: ldrumm, sammcall
Differential Revision: https://reviews.llvm.org/D133236
show more ...
|
Revision tags: llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1 |
|
#
591be7ec |
| 15-Apr-2020 |
Sam McCall <sam.mccall@gmail.com> |
[Format] Work around current vim bugs in clang-format.py
Summary: Do line/col to byte conversions on the python side rather than relying on vim. Its calculations are off when text annotations are pr
[Format] Work around current vim bugs in clang-format.py
Summary: Do line/col to byte conversions on the python side rather than relying on vim. Its calculations are off when text annotations are present: - https://github.com/vim/vim/issues/5930 - https://github.com/vim/vim/issues/3718 (fixed, but vim 8.1 is still common)
Reviewers: hokein
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78198
show more ...
|
Revision tags: llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3 |
|
#
79f8c20e |
| 06-Dec-2019 |
mydeveloperday <mydeveloperday@gmail.com> |
update string comparison in clang-format.py
Summary: Python 3.8 introduces a SyntaxWarning about string comparisons with 'is'. This commit updates the string comparison in clang-format.py that is do
update string comparison in clang-format.py
Summary: Python 3.8 introduces a SyntaxWarning about string comparisons with 'is'. This commit updates the string comparison in clang-format.py that is done with 'is not' to '!='. This should not break compatibility with older python versions (tested 3.4.9, 2.7.17, 2.7.5, 3.8.0).
Reviewers: MyDeveloperDay, klimek, llvm-commits, cfe-commits
Reviewed By: MyDeveloperDay, klimek
Patch By: pseyfert
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D70664
show more ...
|
#
b8e03ff5 |
| 06-Dec-2019 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] update trailing newline treatment in clang-format.py
Summary: The current clang-format.py does not handle trailing newlines at the end of a file correctly. Trailing empty lines get re
[clang-format] update trailing newline treatment in clang-format.py
Summary: The current clang-format.py does not handle trailing newlines at the end of a file correctly. Trailing empty lines get removed except one. As far as I understand this is because clang-format gets fed from stdin and writes to stdout when called from clang-format.py. In a "normal" file (with no trailing empty lines) the string that gets passed to clang-format does not contain a trailing '\n' after the '\n'.join from python. The clang-format binary does not add a trailing newline to input from stdin, but (if there are multiple trailing '\n', all except one get removed).
When reading back this means that we see in python from a "normal" file a string with no trailing '\n'. From a file with (potentially multiple) empty line(s) at the end, we get a string with one trailing '\n' back in python. In the former case all is fine, in the latter case split('\n') makes one empty line at the end of the file out of the clang-format output. Desired would be instead that the **file** ends with a newline, but not with an empty line.
For the case that a user specifies a range to format (and wants to keep trailing empty lines) I did **not** try to fix this by simply removing all trailing newlines from the clang-format output. Instead, I add a '\n' to the unformatted file content (i.e. newline-terminate what is passed to clang-format) and then strip off the last newline from the output (which itself is now for sure the newline termination of the clang-format output).
(Should this get approved, I'll need someone to help me land this.)
Reviewers: klimek, MyDeveloperDay
Reviewed By: MyDeveloperDay
Patch By: pseyfert
Subscribers: cfe-commits, llvm-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D70864 update trailing newline treatment in clang-format.py
show more ...
|
Revision tags: llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1 |
|
#
6bf9e88a |
| 08-Nov-2019 |
paulhoad <mydeveloperday@gmail.com> |
[clang-format] update comments in clang-format.py for python3 compatibility
Summary: D23319 introduced python3 compatibility to clang-format.py, this is however not reflected by the documentation in
[clang-format] update comments in clang-format.py for python3 compatibility
Summary: D23319 introduced python3 compatibility to clang-format.py, this is however not reflected by the documentation in the comments at the beginning of the file, which show how to use the script with python2 in .vimrc. While the actual mapping a user might want to use may well differ from my suggestion, I think it's nice to show the python2 and python3 version, such that a user can pick from the suggestions instead of googeling the python3 replacement for `:pyf` which they might not be familiar with.
EDIT: picking reviewers according to https://llvm.org/docs/Phabricator.html#finding-potential-reviewers
Reviewers: klimek, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: ilya-biryukov, cfe-commits, llvm-commits, ychen
Patch By: pseyfert
Tags: #clang-tools-extra, #llvm, #clang
Differential Revision: https://reviews.llvm.org/D38446
show more ...
|
Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2 |
|
#
aee94489 |
| 17-May-2019 |
Sam McCall <sam.mccall@gmail.com> |
[ClangFormat] Editor integrations inherit default style from clang-format binary
Summary: This allows downstream customizations to the default style to work without needing to also modify the editor
[ClangFormat] Editor integrations inherit default style from clang-format binary
Summary: This allows downstream customizations to the default style to work without needing to also modify the editor integrations.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49719
llvm-svn: 360996
show more ...
|
Revision tags: llvmorg-8.0.1-rc1, llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1 |
|
#
b748c0e6 |
| 18-Dec-2018 |
Serge Guelton <sguelton@quarkslab.com> |
Portable Python script across Python version
Make scripts more future-proof by importing most __future__ stuff.
Differential Revision: https://reviews.llvm.org/D55208
llvm-svn: 349504
|
Revision tags: llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1, llvmorg-7.0.0, llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2, llvmorg-6.0.1-rc1, llvmorg-5.0.2, llvmorg-5.0.2-rc2, llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2, llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1 |
|
#
8a048c71 |
| 05-Sep-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Fix lines=all case in clang-format.py
llvm-svn: 312536
|
Revision tags: llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3 |
|
#
5fb51ddf |
| 22-Aug-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Fix lines regression in clang-format.py
Summary: This patch fixes a regression after https://reviews.llvm.org/rL305665, which updates the structure of the `lines` variable.
Reviewers
[clang-format] Fix lines regression in clang-format.py
Summary: This patch fixes a regression after https://reviews.llvm.org/rL305665, which updates the structure of the `lines` variable.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D37011
llvm-svn: 311456
show more ...
|
Revision tags: llvmorg-5.0.0-rc2, llvmorg-5.0.0-rc1 |
|
#
271dd060 |
| 19-Jun-2017 |
Daniel Jasper <djasper@google.com> |
clang-format: Add capability to format the diff on save in vim.
With this patch, one can configure a BufWrite hook that will make the clang-format integration compute a diff of the current buffer wi
clang-format: Add capability to format the diff on save in vim.
With this patch, one can configure a BufWrite hook that will make the clang-format integration compute a diff of the current buffer with the file that's on disk and format all changed lines. This should create a zero-overhead auto-format solution that doesn't require the file to already be clang-format clean to avoid spurious diffs.
Review: https://reviews.llvm.org/D32429 llvm-svn: 305665
show more ...
|
Revision tags: llvmorg-4.0.1, llvmorg-4.0.1-rc3, llvmorg-4.0.1-rc2, llvmorg-4.0.1-rc1, llvmorg-4.0.0, llvmorg-4.0.0-rc4, llvmorg-4.0.0-rc3, llvmorg-4.0.0-rc2, llvmorg-4.0.0-rc1 |
|
#
0972da78 |
| 10-Dec-2016 |
Vedant Kumar <vsk@apple.com> |
[clang-format] Another attempt at python 3 compatibility
The entries in vim.current.buffer appear to be decoded strings, which means that python3 won't allow invoking 'decode' on them. Keep the old
[clang-format] Another attempt at python 3 compatibility
The entries in vim.current.buffer appear to be decoded strings, which means that python3 won't allow invoking 'decode' on them. Keep the old behavior when running under python2, but skip the error-inducing decode step with python3..
llvm-svn: 289308
show more ...
|
Revision tags: llvmorg-3.9.1, llvmorg-3.9.1-rc3, llvmorg-3.9.1-rc2, llvmorg-3.9.1-rc1 |
|
#
115d225c |
| 27-Oct-2016 |
Alexander Kornienko <alexfh@google.com> |
Attempt to make clang-format.py python 3 - compatible.
llvm-svn: 285301
|
#
179e803a |
| 27-Oct-2016 |
Alexander Kornienko <alexfh@google.com> |
Fix warnings from python difflib.
llvm-svn: 285291
|
#
f51bf969 |
| 24-Oct-2016 |
Alexander Kornienko <alexfh@google.com> |
Fix clang-format vim integration issue with non-ascii characters
clang-format.py currently seems to treat vim.current.buf as ascii-encoded data, which leads to an UnicodeDecodeError when trying to f
Fix clang-format vim integration issue with non-ascii characters
clang-format.py currently seems to treat vim.current.buf as ascii-encoded data, which leads to an UnicodeDecodeError when trying to format any text containing non-ascii characters:
Traceback (most recent call last): File "<string>", line 1, in <module> File ".../tools/clang/tools/clang-format/clang-format.py", line 110, in <module> main() File ".../tools/clang/tools/clang-format/clang-format.py", line 87, in main stdout, stderr = p.communicate(input=text.encode(encoding)) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 3996: ordinal not in range(128)
llvm-svn: 284988
show more ...
|
#
ff7c77f9 |
| 31-Aug-2016 |
Luke Drummond <luke.drummond@codeplay.com> |
[clang-format-vim] Support vim linked against py3
clang-format.py previously only worked in vim compiled against python2.
This patch adds the necessary syntax changes to make this work with vim lin
[clang-format-vim] Support vim linked against py3
clang-format.py previously only worked in vim compiled against python2.
This patch adds the necessary syntax changes to make this work with vim linked against python3, which is now shipped by default for at least Ubuntu16 and Arch.
Differential Revision: https://reviews.llvm.org/D23319
Subscribers: cfe-commits llvm-svn: 280240
show more ...
|
Revision tags: llvmorg-3.9.0, llvmorg-3.9.0-rc3, llvmorg-3.9.0-rc2, llvmorg-3.9.0-rc1, llvmorg-3.8.1, llvmorg-3.8.1-rc1, llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1 |
|
#
da446770 |
| 16-Nov-2015 |
Daniel Jasper <djasper@google.com> |
clang-format: Enable #include sorting by default.
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 lin
clang-format: Enable #include sorting by default.
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
show more ...
|
#
d89ae9d3 |
| 23-Sep-2015 |
Daniel Jasper <djasper@google.com> |
clang-format: Add initial #include sorting capabilities.
To implement this nicely, add a function that merges two sets of replacements that are meant to be done in sequence. This functionality will
clang-format: Add initial #include sorting capabilities.
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
show more ...
|
Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1 |
|
#
1a5ea6eb |
| 11-Jul-2015 |
Daniel Jasper <djasper@google.com> |
clang-format: Extend vim integration so that a line range can be passed in.
llvm-svn: 241976
|
Revision tags: llvmorg-3.6.2, llvmorg-3.6.2-rc1 |
|
#
c925a905 |
| 04-Jun-2015 |
Chandler Carruth <chandlerc@gmail.com> |
Fix terrible python goof in clang-format.py which broke my vim integration.
Nothing is more important in life than clang-format integration with vim. ;]
llvm-svn: 239098
|
#
99590175 |
| 02-Jun-2015 |
Manuel Klimek <klimek@google.com> |
Make vim also output a helpful message in some error cases.
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
Make vim also output a helpful message in some error cases.
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
show more ...
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1 |
|
#
0fe44465 |
| 17-Apr-2015 |
Daniel Jasper <djasper@google.com> |
clang-format: Add default fallback style.
Thanks to Michael Schlottke.
llvm-svn: 235162
|
#
23341446 |
| 16-Apr-2015 |
Daniel Jasper <djasper@google.com> |
clang-format: add an option for fallback style in vimrc
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
clang-format: add an option for fallback style in vimrc
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
show more ...
|