| 149 | } |
| 150 | |
| 151 | pub fn get_lib_call_graph() -> &'static CallGraph { |
| 152 | static GRAPH: OnceCell<CallGraph> = OnceCell::new(); |
| 153 | GRAPH.get_or_init(|| { |
| 154 | let deopt = Deopt::new(get_library_name()).unwrap(); |
| 155 | let dot_path: PathBuf = [ |
| 156 | deopt.get_library_build_dir().unwrap(), |
| 157 | "work".into(), |
| 158 | "callgraph.dot".into(), |
| 159 | ] |
| 160 | .iter() |
| 161 | .collect(); |
| 162 | let (nodes, edges) = dot_parser(&dot_path).unwrap(); |
| 163 | let mut call_graph = CallGraph::new(); |
| 164 | call_graph.construct(nodes, edges); |
| 165 | call_graph |
| 166 | }) |
| 167 | } |
| 168 | |
| 169 | #[cfg(test)] |
| 170 | mod test { |