MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / extract_header_dependency

Method extract_header_dependency

src/analysis/header.rs:78–104  ·  view source on GitHub ↗
(&self, header: &Path)

Source from the content-addressed store, hash-verified

76
77impl Executor {
78 fn extract_header_dependency(&self, header: &Path) -> Result<TreeNode> {
79 let header_path = self.deopt.get_library_build_header_path()?;
80 let output = Command::new("clang++")
81 .current_dir(&header_path)
82 .arg("-fsyntax-only")
83 .arg("-H")
84 .arg("-I.")
85 .arg(header)
86 .stdout(Stdio::null())
87 .stderr(Stdio::piped())
88 .output()
89 .expect("fail to extract header dependency");
90 if !output.status.success() {
91 log::trace!("{}", String::from_utf8_lossy(&output.stderr));
92 return Ok(TreeNode::new_invalid());
93 }
94 let base_name = header
95 .to_str()
96 .unwrap()
97 .strip_prefix(header_path.to_str().unwrap())
98 .unwrap();
99 let base_name = [".", base_name].concat();
100 let output = String::from_utf8_lossy(&output.stderr).to_string();
101 let mut tree = parse_dependency_tree(&output, &base_name, &header_path)?;
102 tree.get_clean_root(&self.deopt);
103 Ok(tree)
104 }
105}
106
107fn get_layer_child(layered_nodes: Vec<(usize, &str)>, depth: usize) -> Vec<TreeNode> {

Callers 1

get_library_dep_treesFunction · 0.80

Calls 3

parse_dependency_treeFunction · 0.85
get_clean_rootMethod · 0.80

Tested by

no test coverage detected