For each struct, collect the set of struct names it points to. Returns dict {struct_name: {referenced_struct_names}}.
(all_structs)
| 220 | # --------------------------------------------------------------------------- |
| 221 | |
| 222 | def 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 | |
| 239 | def expand_reachable(roots, graph): |
no test coverage detected