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

Method find_callexpr

src/ast/visitor.rs:232–251  ·  view source on GitHub ↗

find the callexpr of the i-th call.

(&self, call_name: &str, call_i: usize)

Source from the content-addressed store, hash-verified

230
231 /// find the callexpr of the i-th call.
232 pub fn find_callexpr(&self, call_name: &str, call_i: usize) -> Option<&Node> {
233 let mut worklist = WorkList::new();
234 worklist.push(&self.ast);
235 let mut i = 0;
236 while !worklist.empty() {
237 let curr = worklist.pop();
238 if let Clang::CallExpr(ce) = &curr.kind {
239 let name = ce.get_name_as_string(curr);
240 if name == call_name {
241 if call_i == i {
242 return Some(curr);
243 } else {
244 i += 1;
245 }
246 }
247 }
248 worklist.push_childs(curr.get_childs());
249 }
250 None
251 }
252
253 pub fn find_callexprs(&self, call_name: &str) -> Vec<&Node> {
254 let mut worklist = WorkList::new();

Callers 4

is_ret_by_callFunction · 0.80

Calls 6

emptyMethod · 0.80
popMethod · 0.80
get_name_as_stringMethod · 0.80
push_childsMethod · 0.80
pushMethod · 0.45
get_childsMethod · 0.45

Tested by

no test coverage detected