Skip to content

Commit

Permalink
[analyzer] Don't run ClangSA checkers from clang-tidy
Browse files Browse the repository at this point in the history
`clang-tidy` can invoke some ClangSA checkers. We are disabling this
behavior by default, because ClangSA checkers should run through ClangSA
itself. We missed this disable if analyzer config options were given to
clang-tidy. If ClangSA has some bug then it would effect clang-tidy
analysis too. That's the real reason why we force disabling.
  • Loading branch information
bruntib committed Sep 1, 2021
1 parent 0a57b98 commit 48f3e91
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ def get_checker_list(self, config) -> Tuple[List[str], List[str]]:
If the file specified by the '--tidy-config' option contains a 'Checks'
key or the 'Checks' option is specified through the '--analyzer-config'
the return value will be a tuple of empty lists which means do not turn
checkers explicitly.
checkers explicitly. "clang-analyzer-*" is an exception, because we
want to disable these even if analyzer config is given. If we wouldn't
disable this group then some ClangSA checkers would be invoked by
clang-tidy and in some cases that would cause analysis error due to
some ClangSA bug.
"""
checkers = []
compiler_warnings = []
Expand All @@ -158,7 +162,7 @@ def get_checker_list(self, config) -> Tuple[List[str], List[str]]:
# valid dictionary.
checker_cfg = ast.literal_eval(config.checker_config.strip())
if checker_cfg.get('Checks'):
return checkers, compiler_warnings
return ['-clang-analyzer-*'], compiler_warnings
except SyntaxError as ex:
LOG.debug("Invalid checker configuration: %s. Error: %s",
config.checker_config, ex)
Expand Down

0 comments on commit 48f3e91

Please sign in to comment.