This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] check_clang_tidy.py: Print output nicely in Python 3.
AbandonedPublic

Authored by PiotrZSL on Jun 1 2022, 10:28 PM.

Details

Reviewers
sammccall
mboehme
Summary

In Python 3, encode() produces a bytes. The way this is printed makes it
very hard to read the clang-tidy output because everything gets jammed onto one
line (newlines are printed as \n).

The encode() was introduced here:

https://github.com/llvm/llvm-project/commit/a35efc4dcb70658ebd704c28dfeed4cc2bac095b

It seems that this was done to print non-ASCII characters correctly in Python 2,
and this seems worth preserving (though anyone still on Python 2 should really
be migrating).

For the time being, I've simply introduced a version distinction. I'm not sure
if there's a more idiomatic way to do this that works in both Python 2 and
Python 3 -- input welcome!

Diff Detail

Event Timeline

mboehme created this revision.Jun 1 2022, 10:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2022, 10:28 PM
Herald added a subscriber: xazax.hun. · View Herald Transcript
mboehme requested review of this revision.Jun 1 2022, 10:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2022, 10:28 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
PiotrZSL commandeered this revision.Jul 23 2023, 8:06 AM
PiotrZSL abandoned this revision.
PiotrZSL added a reviewer: mboehme.