From c18284ed0dcc2f750e2755bb66dc39272cd664ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Endre=20F=C3=BCl=C3=B6p?= Date: Mon, 19 Jan 2026 22:04:42 +0100 Subject: [PATCH] [analyzer] Completely remove -analyzer-opt-analyze-headers This option is an undocumented, off-by default flag in upstream Clang. We have measured that disabling this lead to an overall ~24% decrease in analysis time with some loss and shifting around of the result set on open source projects, and concluded that it worth disabling. Users still should have the possiblity of enabling this via configuring the analyzer with analyzer options, but not the other way around: there is no flag to disable this functionality once it is enabled. --- .../codechecker_analyzer/analyzers/clangsa/analyzer.py | 2 -- analyzer/tests/unit/test_analyzer_command.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py b/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py index 021fab2c3e..f5e4195920 100644 --- a/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py @@ -507,8 +507,6 @@ def construct_analyzer_cmd(self, result_handler): analyzer_mode = 'plist-multi-file' analyzer_cmd.extend(['-Xclang', - '-analyzer-opt-analyze-headers', - '-Xclang', '-analyzer-output=' + analyzer_mode, '-o', analyzer_output_file]) diff --git a/analyzer/tests/unit/test_analyzer_command.py b/analyzer/tests/unit/test_analyzer_command.py index 33fabc9459..980d6f8f2f 100644 --- a/analyzer/tests/unit/test_analyzer_command.py +++ b/analyzer/tests/unit/test_analyzer_command.py @@ -63,3 +63,13 @@ def test_isystem_idirafter(self): result_handler = create_result_handler(analyzer) cmd = analyzer.construct_analyzer_cmd(result_handler) self.assertIn('-idirafter', cmd) + + def test_no_analyze_headers(self): + """ + Test that the -analyzer-opt-analyze-headers flag is NOT present in the + analyzer command. + """ + analyzer = create_analyzer_sa() + result_handler = create_result_handler(analyzer) + cmd = analyzer.construct_analyzer_cmd(result_handler) + self.assertNotIn('-analyzer-opt-analyze-headers', cmd)