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

Function is_defined_in_headers

src/execution/ast.rs:165–181  ·  view source on GitHub ↗

whether the ast element is definied inside the header file

(loc: &SourceLocation, headers: &Vec<PathBuf>)

Source from the content-addressed store, hash-verified

163
164/// whether the ast element is definied inside the header file
165fn is_defined_in_headers(loc: &SourceLocation, headers: &Vec<PathBuf>) -> bool {
166 for header in headers {
167 if let Some(loc) = &loc.spelling_loc {
168 let file_path = PathBuf::from(loc.file.to_string());
169 if file_path.eq(header) {
170 return true;
171 }
172 }
173 if let Some(loc) = &loc.expansion_loc {
174 let file_path = PathBuf::from(loc.file.to_string());
175 if file_path.eq(header) {
176 return true;
177 }
178 }
179 }
180 false
181}
182
183/// LLMs tends to re-declare the provided API in code.
184/// Those duplicate definitions cause link error, thus those duplicated definitions need to be removed.

Callers 1

eliminate_irrelative_astFunction · 0.85

Calls 1

eqMethod · 0.80

Tested by

no test coverage detected