jbcoe accepted this revision.
jbcoe added a comment.
This revision is now accepted and ready to land.
LGTM
https://reviews.llvm.org/D30773
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com
EricWF updated this revision to Diff 96025.
EricWF added a comment.
I've committed all but the `str` vs `byte` changes upstream.
https://reviews.llvm.org/D30773
Files:
tools/clang-format/git-clang-format
Index: tools/clang-format/git-clang-format
mgorny added inline comments.
Comment at: tools/clang-format/git-clang-format:306
+try:
+return to_string(bytes.decode('utf-8'))
+except AttributeError: # 'str' object has no attribute 'decode'.
EricWF wrote:
> mgorny wrote:
> > EricWF wrote:
> >
EricWF updated this revision to Diff 91456.
EricWF added a comment.
- Rewrite `to_string` for clarities sake.
https://reviews.llvm.org/D30773
Files:
tools/clang-format/git-clang-format
Index: tools/clang-format/git-clang-format
EricWF added inline comments.
Comment at: tools/clang-format/git-clang-format:306
+try:
+return to_string(bytes.decode('utf-8'))
+except AttributeError: # 'str' object has no attribute 'decode'.
mgorny wrote:
> EricWF wrote:
> > mgorny wrote:
> >
mgorny added inline comments.
Comment at: tools/clang-format/git-clang-format:306
+try:
+return to_string(bytes.decode('utf-8'))
+except AttributeError: # 'str' object has no attribute 'decode'.
EricWF wrote:
> mgorny wrote:
> > This logic looks r
EricWF updated this revision to Diff 91452.
EricWF marked an inline comment as done.
EricWF added a comment.
- rename variables so they don't conflict with type names.
https://reviews.llvm.org/D30773
Files:
tools/clang-format/git-clang-format
Index: tools/clang-format/git-clang-format
==
On Thu, Mar 9, 2017 at 9:36 AM, Nico Weber wrote:
> Consider landing the obvious bits (print function, mostly) separately and
> use this only for the interesting bits.
>
Sounds good. I just wanted to make sure I got the simple bits right as well.
If this doesn't get reviewed in the next week I'
EricWF marked 4 inline comments as done.
EricWF added inline comments.
Comment at: tools/clang-format/git-clang-format:293
+def to_bytes(str):
+# Encode to UTF-8 to get binary data.
These functions are all lifted directly from `lit/util.py`
==
EricWF updated this revision to Diff 91449.
EricWF added a comment.
Add complete implementation.
As far as I've tested this works perfectly in both python2 and python3.
https://reviews.llvm.org/D30773
Files:
tools/clang-format/git-clang-format
Index: tools/clang-format/git-clang-format
Consider landing the obvious bits (print function, mostly) separately and
use this only for the interesting bits.
On Thu, Mar 9, 2017 at 11:10 AM, Michał Górny via Phabricator via
cfe-commits wrote:
> mgorny added inline comments.
>
>
>
> Comment at: tools/clang-format/git-clang
mgorny added inline comments.
Comment at: tools/clang-format/git-clang-format:293
+def to_bytes(str):
+# Encode to UTF-8 to get binary data.
Pretty much a nit but using variable names that match type names can be a bit
confusing here.
Co
EricWF updated this revision to Diff 91145.
EricWF added a comment.
This still isn't working in python3 due to more bytes vs str issues, but this
is my progress so far.
https://reviews.llvm.org/D30773
Files:
tools/clang-format/git-clang-format
Index: tools/clang-format/git-clang-format
kimgr added inline comments.
Comment at: tools/clang-format/git-clang-format:323
allowed_extensions = frozenset(allowed_extensions)
- for filename in dictionary.keys():
+ for filename in list(dictionary.keys()):
base_ext = filename.rsplit('.', 1)
EricWF
EricWF marked 2 inline comments as done.
EricWF added inline comments.
Comment at: tools/clang-format/git-clang-format:323
allowed_extensions = frozenset(allowed_extensions)
- for filename in dictionary.keys():
+ for filename in list(dictionary.keys()):
base_ext = filen
EricWF marked 4 inline comments as done.
EricWF added inline comments.
Comment at: tools/clang-format/git-clang-format:323
allowed_extensions = frozenset(allowed_extensions)
- for filename in dictionary.keys():
+ for filename in list(dictionary.keys()):
base_ext = filen
kimgr added a comment.
Some nits from a Python3 hacker.
Comment at: tools/clang-format/git-clang-format:143
for filename in ignored_files:
-print ' ', filename
+print(' ', filename)
if changed_lines:
I find `print('template', tai
EricWF added a comment.
In https://reviews.llvm.org/D30773#696349, @mgorny wrote:
> In https://reviews.llvm.org/D30773#696301, @EricWF wrote:
>
> > There seem to be a couple cases where it's non-trivial to convert the
> > output from `bytes` to `str`. I'll look into this further and update.
>
>
mgorny added a comment.
In https://reviews.llvm.org/D30773#696301, @EricWF wrote:
> There seem to be a couple cases where it's non-trivial to convert the output
> from `bytes` to `str`. I'll look into this further and update.
Generally bytes<->str conversion should be done using `.decode()` an
EricWF planned changes to this revision.
EricWF added a comment.
There seem to be a couple cases where it's non-trivial to convert the output
from `bytes` to `str`. I'll look into this further and update.
https://reviews.llvm.org/D30773
___
cfe-com
EricWF created this revision.
This patch attempts to make `git-clang-format` both python2 and python3
compatible. Currently it only works in python2.
https://reviews.llvm.org/D30773
Files:
tools/clang-format/git-clang-format
Index: tools/clang-format/git-clang-format
===
21 matches
Mail list logo