[clang-tools-extra] e837ce2 - [clang-tidy] Add -line-filter to run-clang-tidy.py
Kirill Bobyrev via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 28 12:18:21 PDT 2021
Author: Kirill Bobyrev
Date: 2021-06-28T21:17:36+02:00
New Revision: e837ce2a32369b2e9e8e5d60270c072c7dd63827
URL: https://github.com/llvm/llvm-project/commit/e837ce2a32369b2e9e8e5d60270c072c7dd63827
DIFF: https://github.com/llvm/llvm-project/commit/e837ce2a32369b2e9e8e5d60270c072c7dd63827.diff
LOG: [clang-tidy] Add -line-filter to run-clang-tidy.py
This patch allows the use of --line-filter in clang-tidy.py from
run-clang-tidy.py
Author: [bansan (Vincent LE GARREC)](https://reviews.llvm.org/p/bansan/)
Reviewed By: kbobyrev
Differential Revision: https://reviews.llvm.org/D104981
Added:
Modified:
clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
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 313ecd2f95716..de810230b2852 100755
--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -81,13 +81,16 @@ def make_absolute(f, directory):
def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
header_filter, allow_enabling_alpha_checkers,
- extra_arg, extra_arg_before, quiet, config):
+ extra_arg, extra_arg_before, quiet, config,
+ line_filter):
"""Gets a command line for clang-tidy."""
start = [clang_tidy_binary, '--use-color']
if allow_enabling_alpha_checkers:
start.append('-allow-enabling-analyzer-alpha-checkers')
if header_filter is not None:
start.append('-header-filter=' + header_filter)
+ if line_filter is not None:
+ start.append('-line-filter=' + line_filter)
if checks:
start.append('-checks=' + checks)
if tmpdir is not None:
@@ -165,7 +168,7 @@ def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
tmpdir, build_path, args.header_filter,
args.allow_enabling_alpha_checkers,
args.extra_arg, args.extra_arg_before,
- args.quiet, args.config)
+ args.quiet, args.config, args.line_filter)
proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, err = proc.communicate()
@@ -209,6 +212,9 @@ def main():
'headers to output diagnostics from. Diagnostics from '
'the main file of each translation unit are always '
'displayed.')
+ parser.add_argument('-line-filter', default=None,
+ help='List of files with line ranges to filter the'
+ 'warnings.')
if yaml:
parser.add_argument('-export-fixes', metavar='filename', dest='export_fixes',
help='Create a yaml file to store suggested fixes in, '
More information about the cfe-commits
mailing list