Repository navigation
Improve C++ Level-2 call-graph resolution (+7.8pp recall, +9.7pp resolution recall, 99.0% precision) - #9299
Merged
Conversation
…lution recall, 99.0% precision)
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves C++ Level-2 call-graph resolution using general, AST-free C++ semantics across
detector.py,call_resolver.py,receiver_types.py, andreturn_types.py.Key Improvements
include/↔src/constructor linking: Matches C++ constructors declared in headers (e.g.include/fmt/os.h) to out-of-line definitions insrc/(src/os.cc) when stems match and the implementation includes the header.usingalias constructor & wrapper return-type resolution: Resolves calls/constructions through C++ type aliases (e.g.memory_buffer(),appender(buf),string_view(...)) to their underlying repo class, and unwraps C++ smart-pointer/wrapper aliases (expected<T, E>,optional<T>,unique_ptr<T>,shared_ptr<T>) on->/ factory chains.constvs non-constmember overload disambiguation: Detectsconst-qualified receivers (const T&,T const&,const auto&, andthisinsideconstmethods) to narrowconst/ non-constmember overloads (data(),begin(),end())..ccclass field propagation & 1-hop struct field chains: Propagates C++ class member field types from headers into out-of-line.ccmethods and resolves 1-hop struct field receivers (pipe.read_end.descriptor(),pipe.read_end.fdopen("r").get()).<...>call chains & namespace-qualified factory chains: Skips balanced C++ template argument lists before(inextract_expr_chainand falls back cleanly on namespace-qualified factory calls (fmt::scan<T>(...)->value()).open_buffered_file(FILE** fp = nullptr)) and widens matching.ccimplementations (stem-scoped so unrelated overloads are untouched).arg0_kind&char_width): Enforces arity-first filtering, disambiguates compiled-string vs string-literal vs non-string first arguments (ignoring C++ user-defined string literals like""_cfand mixed call sites), and narrowswchar/utf_wide/narrowoverloads while preserving genericChartemplates and propagating call-site widths through macro expansions.C++ (
fmtlib/fmt, libclang 18.1.1) ResultsGolden Master Updates
Regenerated
tests/golden_master_audit/andtests/golden_master_zero_dep_audit/viatests/tools/crucible_check.py --update --yesbecause the C++ call-resolver improvements resolve additional C++ call edges (updating fan-in, fan-out, and PageRank on C++ corpus files).Verification
tests/core_engine/test_cpp_call_resolution_epic.py(260/260 call-resolver tests passing).ruff_audit.py --ci,mypy_audit.py --ci,dead_key_audit.py --ci, anddoc_refs_audit.py --ciall pass with 0 new findings.tests/call_graph_resolution_cpp_baseline.json.