MCPcopy Create free account
hub / github.com/JRickey/BattleShip / build_struct_graph

Function build_struct_graph

tools/pointer_audit.py:222–236  ·  view source on GitHub ↗

For each struct, collect the set of struct names it points to. Returns dict {struct_name: {referenced_struct_names}}.

(all_structs)

Source from the content-addressed store, hash-verified

220# ---------------------------------------------------------------------------
221
222def build_struct_graph(all_structs):
223 """
224 For each struct, collect the set of struct names it points to.
225 Returns dict {struct_name: {referenced_struct_names}}.
226 """
227 graph = {}
228 for name, body in all_structs.items():
229 refs = set()
230 unguarded, guarded, _ = analyze_body(body)
231 for (_, raw_type) in unguarded + guarded:
232 bt = base_type(raw_type)
233 if bt and bt != name and bt not in PRIMITIVE_OR_OPAQUE:
234 refs.add(bt)
235 graph[name] = refs
236 return graph
237
238
239def expand_reachable(roots, graph):

Callers 1

run_auditFunction · 0.85

Calls 2

analyze_bodyFunction · 0.85
base_typeFunction · 0.85

Tested by

no test coverage detected