Skip to content

Commit

Permalink
Silencing checkers
Browse files Browse the repository at this point in the history
In clangsa we only silence disabled checkers instead of disabling them
because if we switch off a checker it may have effect on the findings
on other checker depending on them.
  • Loading branch information
dkrupp committed May 19, 2021
1 parent b1437e6 commit a4a8a96
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,21 @@ def construct_analyzer_cmd(self, result_handler):
['-Xclang', '-analyzer-config', '-Xclang', cfg])

# Config handler stores which checkers are enabled or disabled.
disabled_checkers = []
for checker_name, value in config.checks().items():
state, _ = value
if state == CheckerState.enabled:
analyzer_cmd.extend(['-Xclang',
'-analyzer-checker=' + checker_name])
elif state == CheckerState.disabled:
analyzer_cmd.extend(['-Xclang',
'-analyzer-disable-checker=' +
checker_name])
disabled_checkers.append(checker_name)

if len(disabled_checkers) > 0:
analyzer_cmd.extend((['-Xclang',
'-analyzer-config',
'-Xclang',
'silence-checkers=' +
';'.join(disabled_checkers)]))

# Enable aggressive-binary-operation-simplification option.
analyzer_cmd.extend(
Expand Down

0 comments on commit a4a8a96

Please sign in to comment.