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

Andi-Bogdan Postelnicu via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 01:37:21 PDT 2020


Author: Andi-Bogdan Postelnicu
Date: 2020-04-23T11:36:50+03:00
New Revision: bbb7921da97ce03d2933e185a525c4e452b146b0

URL: https://github.com/llvm/llvm-project/commit/bbb7921da97ce03d2933e185a525c4e452b146b0
DIFF: https://github.com/llvm/llvm-project/commit/bbb7921da97ce03d2933e185a525c4e452b146b0.diff

LOG: [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

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
    clang-tools-extra/docs/ReleaseNotes.rst

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
index 1eb135295754..1c4f3ad59ac8 100755
--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -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)

diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index d3c3bb0520d1..011962ea1d05 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -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
 -------------------------------
-


        


More information about the cfe-commits mailing list