Skip to content

Commit 9d63a86

Browse files
committed
Merge remote-tracking branch 'upstream/master' into cmd-runs
2 parents 7787aa9 + 9817539 commit 9d63a86

File tree

110 files changed

+2659
-828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2659
-828
lines changed

.github/workflows/config_coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ permissions: read-all
2626
jobs:
2727
checker-config-coverage:
2828
name: "Config coverage of checkers"
29-
runs-on: ubuntu-20.04
29+
runs-on: ubuntu-24.04
3030
steps:
3131
- uses: actions/checkout@v3
3232
- uses: actions/setup-python@v4

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
lint:
1515
name: Linters (pylint, pycodestyle)
1616

17-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-24.04
1818

1919
steps:
2020
- uses: actions/checkout@v2
@@ -29,7 +29,7 @@ jobs:
2929

3030
tools:
3131
name: Tools (report-converter, etc.)
32-
runs-on: ubuntu-20.04
32+
runs-on: ubuntu-24.04
3333

3434
steps:
3535
- uses: actions/checkout@v2
@@ -85,7 +85,7 @@ jobs:
8585
8686
analyzer:
8787
name: Analyzer
88-
runs-on: ubuntu-20.04
88+
runs-on: ubuntu-24.04
8989

9090
steps:
9191
- uses: actions/checkout@v2
@@ -111,7 +111,7 @@ jobs:
111111

112112
common:
113113
name: Common libraries
114-
runs-on: ubuntu-20.04
114+
runs-on: ubuntu-24.04
115115

116116
steps:
117117
- uses: actions/checkout@v2
@@ -130,7 +130,7 @@ jobs:
130130

131131
web:
132132
name: Web
133-
runs-on: ubuntu-20.04
133+
runs-on: ubuntu-24.04
134134

135135
services:
136136
postgres:
@@ -185,7 +185,7 @@ jobs:
185185

186186
gui:
187187
name: GUI
188-
runs-on: ubuntu-20.04
188+
runs-on: ubuntu-24.04
189189

190190
strategy:
191191
matrix:

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ package: package_dir_structure set_git_commit_template package_gerrit_skiplist
6363
$(CC_BUILD_DIR)/config/web_version.json
6464

6565
${PYTHON_BIN} ./scripts/build/create_commands.py -b $(BUILD_DIR) \
66-
--cmd-dir $(ROOT)/codechecker_common/cmd \
67-
$(CC_WEB)/codechecker_web/cmd \
68-
$(CC_SERVER)/codechecker_server/cmd \
69-
$(CC_CLIENT)/codechecker_client/cmd \
70-
$(CC_ANALYZER)/codechecker_analyzer/cmd \
66+
--cmd-dir $(ROOT)/codechecker_common/cli_commands \
67+
$(CC_WEB)/codechecker_web/cli \
68+
$(CC_SERVER)/codechecker_server/cli \
69+
$(CC_CLIENT)/codechecker_client/cli \
70+
$(CC_ANALYZER)/codechecker_analyzer/cli \
7171
--bin-file $(ROOT)/bin/CodeChecker
7272

7373
# Copy license file.

analyzer/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ package: package_analyzer
116116

117117
# Copy CodeChecker entry point sub-commands.
118118
${PYTHON_BIN} $(ROOT)/scripts/build/create_commands.py -b $(BUILD_DIR) \
119-
--cmd-dir $(ROOT)/codechecker_common/cmd \
120-
$(CC_ANALYZER)/codechecker_analyzer/cmd \
119+
--cmd-dir $(ROOT)/codechecker_common/cli_commands \
120+
$(CC_ANALYZER)/codechecker_analyzer/cli \
121121
--bin-file $(ROOT)/bin/CodeChecker
122122

123123
# Copy license file.

analyzer/codechecker_analyzer/analysis_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ def handle_analysis_result(success, zip_file=zip_file):
692692
result_file, action.source
693693

694694
except Exception as e:
695-
LOG.debug_analyzer(str(e))
695+
LOG.debug(str(e))
696696
traceback.print_exc(file=sys.stdout)
697697
return 1, False, reanalyzed, action.analyzer_type, None, \
698698
action.source
@@ -830,7 +830,7 @@ def signal_handler(signum, _):
830830
LOG.info("----==== Summary ====----")
831831

832832
for skp in skipped_actions:
833-
LOG.debug_analyzer("%s is skipped", skp.source)
833+
LOG.debug("%s is skipped", skp.source)
834834

835835
LOG.info("Total analyzed compilation commands: %d",
836836
compile_cmd_count.analyze)

analyzer/codechecker_analyzer/analyzers/analyzer_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def check_supported_analyzers(analyzers):
232232
def construct_analyzer(buildaction, analyzer_config):
233233
analyzer_type = buildaction.analyzer_type
234234

235-
LOG.debug_analyzer('Constructing %s analyzer.', analyzer_type)
235+
LOG.debug('Constructing %s analyzer.', analyzer_type)
236236
if analyzer_type in supported_analyzers:
237237
analyzer = \
238238
supported_analyzers[analyzer_type](analyzer_config, buildaction)

analyzer/codechecker_analyzer/analyzers/clangsa/analyzer.py

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
import os
1313
import plistlib
1414
import re
15-
import shlex
1615
import subprocess
16+
import sys
17+
from typing import List, Tuple
1718

18-
from typing import List
19-
19+
from codechecker_common import util
2020
from codechecker_common.logger import get_logger
2121

2222
from codechecker_analyzer import analyzer_context, env
@@ -42,7 +42,7 @@
4242
def parse_clang_help_page(
4343
command: List[str],
4444
start_label: str
45-
) -> List[str]:
45+
) -> List[Tuple[str, str]]:
4646
"""
4747
Parse the clang help page starting from a specific label.
4848
Returns a list of (flag, description) tuples.
@@ -121,6 +121,12 @@ class ClangSA(analyzer_base.SourceAnalyzer):
121121

122122
__ctu_autodetection = None
123123

124+
__additional_analyzer_config = {
125+
'cc-verbatim-args-file':
126+
'A file path containing flags that are forwarded verbatim to the '
127+
'analyzer tool. E.g.: cc-verbatim-args-file=<filepath>'
128+
}
129+
124130
def __init__(self, cfg_handler, buildaction):
125131
super().__init__(cfg_handler, buildaction)
126132
self.__disable_ctu = False
@@ -308,15 +314,17 @@ def get_checker_config(cls) -> List[str]:
308314
return parse_clang_help_page(command, 'OPTIONS:')
309315

310316
@classmethod
311-
def get_analyzer_config(cls) -> List[str]:
317+
def get_analyzer_config(cls) -> List[Tuple[str, str]]:
312318
"""Return the list of analyzer config options."""
313319
command = [cls.analyzer_binary(), "-cc1"]
314320

315321
cls.__add_plugin_load_flags(command)
316322

317323
command.append("-analyzer-config-help")
318324

319-
return parse_clang_help_page(command, 'OPTIONS:')
325+
native_config = parse_clang_help_page(command, 'OPTIONS:')
326+
327+
return native_config + list(cls.__additional_analyzer_config.items())
320328

321329
def post_analyze(self, result_handler):
322330
"""
@@ -636,28 +644,13 @@ def construct_config_handler(cls, args):
636644
'ctu_ast_mode' in args and \
637645
args.ctu_ast_mode == 'parse-on-demand'
638646

639-
try:
640-
with open(args.clangsa_args_cfg_file, 'r', encoding='utf8',
641-
errors='ignore') as sa_cfg:
642-
handler.analyzer_extra_arguments = \
643-
re.sub(r'\$\((.*?)\)',
644-
env.replace_env_var(args.clangsa_args_cfg_file),
645-
sa_cfg.read().strip())
646-
handler.analyzer_extra_arguments = \
647-
shlex.split(handler.analyzer_extra_arguments)
648-
except IOError as ioerr:
649-
LOG.debug_analyzer(ioerr)
650-
except AttributeError as aerr:
651-
# No clangsa arguments file was given in the command line.
652-
LOG.debug_analyzer(aerr)
653-
654647
checkers = ClangSA.get_analyzer_checkers()
655648

656649
try:
657650
cmdline_checkers = args.ordered_checkers
658651
except AttributeError:
659-
LOG.debug_analyzer('No checkers were defined in '
660-
'the command line for %s', cls.ANALYZER_NAME)
652+
LOG.debug('No checkers were defined in the command line for %s',
653+
cls.ANALYZER_NAME)
661654
cmdline_checkers = []
662655

663656
handler.initialize_checkers(
@@ -716,7 +709,19 @@ def construct_config_handler(cls, args):
716709
if 'analyzer_config' in args and \
717710
isinstance(args.analyzer_config, list):
718711
for cfg in args.analyzer_config:
719-
if cfg.analyzer == cls.ANALYZER_NAME:
712+
# TODO: The analyzer plugin should get only its own analyzer
713+
# config options from outside.
714+
if cfg.analyzer != cls.ANALYZER_NAME:
715+
continue
716+
717+
if cfg.option == 'cc-verbatim-args-file':
718+
try:
719+
handler.analyzer_extra_arguments = \
720+
util.load_args_from_file(cfg.value)
721+
except FileNotFoundError:
722+
LOG.error(f"File not found: {cfg.value}")
723+
sys.exit(1)
724+
else:
720725
handler.checker_config.append(f"{cfg.option}={cfg.value}")
721726

722727
return handler

analyzer/codechecker_analyzer/analyzers/clangsa/ctu_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def generate_invocation_list(triple_arch, action, source, config):
107107
{str(source_path): cmd},
108108
width=maxsize, Dumper=LLVMComatibleYamlDumper)
109109

110-
LOG.debug_analyzer("Appending invocation list item '%s'", invocation_line)
110+
LOG.debug("Appending invocation list item '%s'", invocation_line)
111111

112112
# Append the next entry into the invocation list yaml.
113113
with invocation_list.open('a', encoding='utf-8', errors='ignore') as \

0 commit comments

Comments
 (0)