Skip to content

[Feature]Merge cpp_deep: libclang C/C++ deep analysis for macro expan… - #1841

Closed
silentsea323 wants to merge 0 commit into
Graphify-Labs:v8from
silentsea323:v8
Closed

[Feature]Merge cpp_deep: libclang C/C++ deep analysis for macro expan…#1841
silentsea323 wants to merge 0 commit into
Graphify-Labs:v8from
silentsea323:v8

Conversation

@silentsea323

Copy link
Copy Markdown

…sion + cross-DLL call chains

Ported from local 0.9.8 fork with 31 commits of cpp_deep development. Key features:

  • libclang-based C/C++ semantic parsing (macro expansion, USR resolution)
  • Parallel TU parsing (ThreadPoolExecutor, --cpp-workers flag)
  • Per-TU disk cache with crash recovery (clang_cache/)
  • .graphifyignore integration
  • Progress logging (stderr + cpp_deep.log + .cpp_deep_status.json)
  • Cross-module/DLL call tracking (EXTRACTED edges)
  • graphify optimize command
  • Command aliases (q/p/e/ex/u/co/opt)
  • Roslyn probe prototype for C# deep analysis
  • Comprehensive unit+integration tests (55 tests)
  • Build/install scripts (build_wheel.sh/bat, install.sh/bat)

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread graphify/cpp_deep/cache.py Outdated
return cd / f"{cache_key(tu_path, args)}.json"


def write(result: TUResult, args: list[str]) -> None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regressionwrite()

6 callers depend on it (afferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Comment thread graphify/cpp_deep/clang_index.py Outdated
_LOG = logging.getLogger(__name__)


class ClangUnavailable(RuntimeError):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regressionClangUnavailable

fans out to 6 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Comment thread graphify/cpp_deep/clang_index.py Outdated
# ── Translation-unit parsing → records ───────────────────────────────────────


def parse_translation_unit(unit, root: Path, stem_of=None, file_id_of=None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regressionparse_translation_unit()

fans out to 8 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Comment thread graphify/cpp_deep/clang_index.py Outdated
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]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression_ids_for()

high coupling complexity (Ca·Ce = 12).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Comment thread graphify/cpp_deep/clang_index.py Outdated
return f"{name}()"
return name

def _walk(cursor, enclosing_id: str | None):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression_walk()

fans out to 12 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Comment thread graphify/csharp_deep/pipeline.py Outdated
return mapping


def run_pipeline(per_file: list[dict], all_nodes: list[dict], all_edges: list[dict]) -> None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regressionrun_pipeline()

fans out to 19 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Comment thread graphify/csharp_deep/roslyn_index.py Outdated
return None


def parse_file(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regressionparse_file()

6 callers depend on it (afferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Comment thread graphify/csharp_deep/sln_discovery.py Outdated
return proj_paths


def parse_csproj(proj_path: Path) -> ProjectInfo | None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regressionparse_csproj()

7 callers depend on it (afferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Comment thread tests/test_cpp_deep.py Outdated
assert cd.is_enabled() is True


def test_id_alignment_with_tree_sitter():

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regressiontest_id_alignment_with_tree_sitter()

fans out to 6 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Comment thread tests/test_cpp_deep.py Outdated
assert isinstance(k, str) and len(k) == 16


def test_cache_round_trip(tmp_path, monkeypatch):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regressiontest_cache_round_trip()

fans out to 7 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant