[clang-tidy] Add option to use alpha checkers from clang-analyzer when using `run-clang-tidy.py`

Summary: Add option to use alpha checkers from clang-analyzer when using `run-clang-tidy.py`.

Reviewers: JonasToth

Subscribers: xazax.hun, baloghadamsoftware, a.sidorin, Szelethus, donat.nagy, dkrupp, Charusso, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77882
This commit is contained in:
Andi-Bogdan Postelnicu 2020-04-10 19:25:31 +03:00
parent 613f12dd8e
commit bbb7921da9
2 changed files with 15 additions and 3 deletions

View File

@ -78,10 +78,12 @@ def make_absolute(f, directory):
def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
header_filter, extra_arg, extra_arg_before, quiet,
config):
header_filter, allow_enabling_alpha_checkers,
extra_arg, extra_arg_before, quiet, config):
"""Gets a command line for clang-tidy."""
start = [clang_tidy_binary]
if allow_enabling_alpha_checkers is not None:
start.append('-allow-enabling-analyzer-alpha-checkers')
if header_filter is not None:
start.append('-header-filter=' + header_filter)
if checks:
@ -159,6 +161,7 @@ def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
name = queue.get()
invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
tmpdir, build_path, args.header_filter,
args.allow_enabling_alpha_checkers,
args.extra_arg, args.extra_arg_before,
args.quiet, args.config)
@ -179,6 +182,9 @@ def main():
'in a compilation database. Requires '
'clang-tidy and clang-apply-replacements in '
'$PATH.')
parser.add_argument('-allow-enabling-alpha-checkers',
action='store_true', help='allow alpha checkers from '
'clang-analyzer.')
parser.add_argument('-clang-tidy-binary', metavar='PATH',
default='clang-tidy',
help='path to clang-tidy binary')
@ -238,6 +244,8 @@ def main():
try:
invocation = [args.clang_tidy_binary, '-list-checks']
if args.allow_enabling_alpha_checkers:
invocation.append('-allow-enabling-analyzer-alpha-checkers')
invocation.append('-p=' + build_path)
if args.checks:
invocation.append('-checks=' + args.checks)

View File

@ -188,6 +188,11 @@ Renamed checks
- The 'fuchsia-restrict-system-headers' check was renamed to :doc:`portability-restrict-system-includes
<clang-tidy/checks/portability-restrict-system-includes>`
Other improvements
^^^^^^^^^^^^^^^^^^
- For 'run-clang-tidy.py' add option to use alpha checkers from clang-analyzer.
Improvements to include-fixer
-----------------------------
@ -210,4 +215,3 @@ The improvements are...
Clang-tidy visual studio plugin
-------------------------------