diff --git a/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py b/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py index 8aaafe7dd1..6c2168d5a3 100644 --- a/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py @@ -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(