[PATCH] D48098: clang-format-diff: Switch to python3 by default, support python 2.7

Marco Falke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 13 15:02:09 PDT 2018


MarcoFalke added a comment.

>   why is this switch necessary?

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/)

>   what's expected to be supported with it?

I'd assume python2.7 (which is the only supported python2) and everything from python3.4 and upward.

>   how do I test it?

The clang-format-diff.py is a wrapper around clang-format, to format only a diff. You can get any diff, e.g. the last ten commits to the master branch:

  git diff HEAD~10 -U0 | python2 ./tools/clang-format/clang-format-diff.py

(You might have to pass `-p1`)

Then test that the following options work with both python2 and python3:

  -i -v  # flags
  -regex # could be -regex '.*\.h'
  -iregex # could be -iregex '.*\.H'




https://reviews.llvm.org/D48098





More information about the cfe-commits mailing list