[PATCH] D86209: [clang-tidy] run-clang-tidy.py: Fix -allow-enabling-analyzer-alpha-checkers always being passed

Joachim Priesner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 19 06:05:10 PDT 2020


jspam created this revision.
Herald added subscribers: cfe-commits, ASDenysPetrov, Charusso, dkrupp, donat.nagy, Szelethus, a.sidorin, baloghadamsoftware, xazax.hun.
Herald added a project: clang.
jspam requested review of this revision.

The `action='store_true'` option of `argparse.add_argument` implicitly
generates a default value of False if the argument is not specified.
Thus, the `allow_enabling_alpha_checkers` argument of
`get_tidy_invocation` is never None.

Fixes: bbb7921da97ce03d2933e185a525c4e452b146b0 <https://reviews.llvm.org/rGbbb7921da97ce03d2933e185a525c4e452b146b0>

[1] https://docs.python.org/3/library/argparse.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86209

Files:
  clang-tools-extra/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -84,7 +84,7 @@
                         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:
+  if allow_enabling_alpha_checkers:
     start.append('-allow-enabling-analyzer-alpha-checkers')
   if header_filter is not None:
     start.append('-header-filter=' + header_filter)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86209.286542.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200819/5bed95b0/attachment.bin>


More information about the cfe-commits mailing list