Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 98748bf751144e538ca55f0b0adee84bff5bc469
https://github.com/WebKit/WebKit/commit/98748bf751144e538ca55f0b0adee84bff5bc469
Author: Claudio Saavedra <[email protected]>
Date: 2026-09-30 (Wed, 30 Sep 2026)
Changed paths:
M Tools/Scripts/analyze-safer-cpp
A Tools/Scripts/webkitpy/safer_cpp/analyzer.py
Log Message:
-----------
Move the shared pieces of analyze-safer-cpp into webkitpy
https://bugs.webkit.org/show_bug.cgi?id=325586
Reviewed by Ryosuke Niwa.
A whole-tree Safer C++ analysis for the CMake ports needs the same
pieces analyze-safer-cpp already has: the analyzer lookup and the
rewriting of a compile_commands.json entry into a clang --analyze
invocation, including the prefix header decomposition and the defines
open source clang needs. Move them into webkitpy/safer_cpp/analyzer.py
so the driver that produces Apple's StaticAnalyzer/<Project> layout
from a CMake build can import them instead of copying them.
The moved code is unchanged apart from three points. rewrite_argv()
takes the analyzer output format and destination as arguments, with
the previous text-to-/dev/null behaviour as the default, since the
whole-tree driver writes HTML reports into a directory. The checkout
root is looked up from the module's own directory instead of the
script's. The compile database options and their resolution are
functions, so the driver can offer the same --gtk, --wpe,
--cmake-preset and --compile-commands options.
analyze-safer-cpp keeps what is specific to at-desk use: applying the
expectations, collecting changed files, mapping headers to translation
units, and its command line.
Review of the moved code: WTF no longer has its own entry in
PROJECT_ROOTS, since only PAL needs to be matched before WebCore;
read_plist_key() is local to find_toolchain_clangs(), its only caller;
and FIXMEs mark the hardcoded download size and the download of the
latest swift.org snapshot rather than the one in
Tools/CISupport/safer-cpp-swift-version.
Running the script before and after this change on the same inputs,
with -v so the rewritten clang command lines are part of the output,
gives identical results on macOS with a cmake-mac tree and on Linux
with a WPE tree, including the error paths and the analyzer lookup.
* Tools/Scripts/analyze-safer-cpp:
(parse_args):
(main):
* Tools/Scripts/webkitpy/safer_cpp/analyzer.py: Added.
(find_webkit_root):
(project_for_path):
(CompileDB):
(resolve_preset_build_dir):
(is_cmake_pch):
(prefix_header_includes):
(rewrite_argv):
(available_checkers):
(drop_unavailable_checkers):
(read_plist_key):
(find_toolchain_clangs):
(download_swift_toolchain):
(find_linux_clang):
(resolve_analyzer_clang):
(resolve_port_build_dir):
(add_compile_commands_arguments):
(resolve_compile_commands_path):
Canonical link: https://commits.webkit.org/322311@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications