[cfe-dev] [clang-tidy] RFC: Need feedback on enhancing run-clang-tidy.py to accept and pass @response_files on to clang-tidy

Don Hinton via cfe-dev cfe-dev at lists.llvm.org
Thu Jun 20 18:54:24 PDT 2019


I'd like to drive run-clang-tidy.py from a git custom command, e.g.:

  $ git clang-tidy <commit> [-fix-errors] [etc...]

And pass the all the files in the diff, with headers going in
'-header-filter='.  This works great for small diffs -- I'm using `git diff
-name-only` under the hood to get the list of files -- but large diffs will
inevitably generate extremely long command lines.

Since clang-tidy can read @response-files, I figure I could just create my
super long command line and pass it through, which would require a small
change to run-clang-tidy.py.  run-clang-tidy.py could then create
individual @respone-files for each clang-tidy instance as needed -- in case
the number of headers is large.  To work, each instance would need the
complete list of headers in the diff.

But, before I go off and start hacking it up, I just wanted to see if
anyone had a better idea.  I guess I'll have the pass the file name to
python as just a regular option, since the @file notation doesn't seem to
be present, but I'm no python expert.

Btw, I have a working prototype, loosely based on git-clang-format, which
can call either clang-tidy directly in a loop, or pass the entire list to
run-clang-tidy.py which can do it in parallel.

thanks...
don
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190620/a714bcd1/attachment.html>


More information about the cfe-dev mailing list