This is an archive of the discontinued LLVM Phabricator instance.

Add -extra-arg-clang-tidy to {clang-tidy-diff,run-clang-tidy}.py
AbandonedPublic

Authored by Xavier on Oct 18 2021, 8:51 AM.

Details

Reviewers
alexfh
Summary

This small patch adds a new -extra-arg-clang-tidy option to clang-tidy-diff and run-clang-tidy scripts. This is especially handy in addition to the -checks option, to tune the executed checks.

Example:

clang-tidy-diff.py -checks='-*,clang-analyzer-*' -extra-arg-clang-tidy='-warnings-as-errors=-*,clang-analyzer-*'

Diff Detail

Event Timeline

Xavier requested review of this revision.Oct 18 2021, 8:51 AM
Xavier created this revision.
Xavier updated this revision to Diff 380429.Oct 18 2021, 8:54 AM
Xavier updated this revision to Diff 380431.Oct 18 2021, 8:57 AM

Note: manually tested the two scripts;

  • For clang-tidy-diff.py
git diff -U0 --no-prefix --no-color $(git merge-base origin/master HEAD)..HEAD \
    | ~/git/llvm-project/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py -quiet -clang-tidy-binary clang-tidy-12 -path=build -j8 \
    -checks='-*,clang-analyzer-*' -extra-arg-clang-tidy='-warnings-as-errors=-*,clang-analyzer-*'
  • For run-clang-tidy.py
~/git/llvm-project/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \
    -checks='-*,clang-analyzer-*' -clang-tidy-binary clang-tidy-12 -p build -extra-arg-clang-tidy='-warnings-as-errors=-*,clang-analyzer-*'
Xavier updated this revision to Diff 380436.Oct 18 2021, 9:09 AM

I realize there is a much better approach: https://reviews.llvm.org/D49864