[Feature]Merge cpp_deep: libclang C/C++ deep analysis for macro expan… - #1841
[Feature]Merge cpp_deep: libclang C/C++ deep analysis for macro expan…#1841silentsea323 wants to merge 0 commit into
Conversation
There was a problem hiding this comment.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
This pull request adds C/C++ deep-analysis tooling to the graphify project. It introduces new wheel build/verification scripts (build_wheel.bat and build_wheel.sh) that clean, build, and check that the produced wheel bundles the cpp_deep package, the [cpp] extra, and skill docs. It also adds design and improvement documentation (docs/cpp-deep-enhancement-design.md, docs/cpp_deep_cbm_improvements.md) describing a proposed libclang-based graphify/cpp_deep/ pipeline for macro expansion, cross-module/DLL call chains, and node deduplication. The changed-symbols list spans the cpp_deep modules, extraction/resolution logic, main/CLI hooks, rationale/doc entries, and a range of test and fixture files, indicating edits across the extraction pipeline, C#/C++ deep-analysis code paths, and their associated tests. Note that most of the diff body beyond the two build scripts and the design doc was truncated in what I can see.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 2286 functions depend on the 1434 functions this change touches.
Health — this change adds coupling hotspots:
- new:
_extract_generic()— 18 callers, 63 callees - new:
_resolve_js_module_path()— 27 callers, 8 callees - worse:
extract_js()— 67 callers, 3 callees - new:
extract_objc()— 27 callers, 6 callees - new:
install()— 11 callers, 10 callees - worse:
extract_python()— 35 callers, 3 callees - new:
_collect_js_symbol_resolution_facts()— 2 callers, 47 callees - worse:
extract_vue()— 10 callers, 9 callees - …and 42 more
Verification — 2286 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 2286 function(s) in the blast radius were not formally verified this run
· 13 grounded finding(s) anchored inline below; 37 more finding(s) on lines outside this diff (see the check run).
| return cd / f"{cache_key(tu_path, args)}.json" | ||
|
|
||
|
|
||
| def write(result: TUResult, args: list[str]) -> None: |
There was a problem hiding this comment.
write()
6 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| _LOG = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class ClangUnavailable(RuntimeError): |
There was a problem hiding this comment.
ClangUnavailable
fans out to 6 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| # ── Translation-unit parsing → records ─────────────────────────────────────── | ||
|
|
||
|
|
||
| def parse_translation_unit(unit, root: Path, stem_of=None, file_id_of=None, |
There was a problem hiding this comment.
parse_translation_unit()
fans out to 8 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| result = TUResult(path=str(unit.path), module=unit.module) | ||
|
|
||
| # Resolve a source file to (symbol_stem, file_node_id) aligned to the baseline. | ||
| def _ids_for(abs_src: str) -> tuple[str, str]: |
There was a problem hiding this comment.
_ids_for()
high coupling complexity (Ca·Ce = 12).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| return f"{name}()" | ||
| return name | ||
|
|
||
| def _walk(cursor, enclosing_id: str | None): |
There was a problem hiding this comment.
_walk()
fans out to 12 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| return mapping | ||
|
|
||
|
|
||
| def run_pipeline(per_file: list[dict], all_nodes: list[dict], all_edges: list[dict]) -> None: |
There was a problem hiding this comment.
run_pipeline()
fans out to 19 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| return None | ||
|
|
||
|
|
||
| def parse_file( |
There was a problem hiding this comment.
parse_file()
6 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| return proj_paths | ||
|
|
||
|
|
||
| def parse_csproj(proj_path: Path) -> ProjectInfo | None: |
There was a problem hiding this comment.
parse_csproj()
7 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| assert cd.is_enabled() is True | ||
|
|
||
|
|
||
| def test_id_alignment_with_tree_sitter(): |
There was a problem hiding this comment.
test_id_alignment_with_tree_sitter()
fans out to 6 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| assert isinstance(k, str) and len(k) == 16 | ||
|
|
||
|
|
||
| def test_cache_round_trip(tmp_path, monkeypatch): |
There was a problem hiding this comment.
test_cache_round_trip()
fans out to 7 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
…sion + cross-DLL call chains
Ported from local 0.9.8 fork with 31 commits of cpp_deep development. Key features: