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

Method find_fd

src/ast/visitor.rs:60–74  ·  view source on GitHub ↗

find the FunctionDecl node named with fd_name.

(&self, fd_name: &str)

Source from the content-addressed store, hash-verified

58
59 /// find the FunctionDecl node named with fd_name.
60 pub fn find_fd(&self, fd_name: &str) -> Option<&Node> {
61 let mut worklist = WorkList::new();
62 worklist.push(&self.ast);
63 while !worklist.empty() {
64 let curr = worklist.pop();
65 if let Clang::FunctionDecl(fd) = &curr.kind {
66 let name = fd.get_name();
67 if name == fd_name {
68 return Some(curr);
69 }
70 }
71 worklist.push_childs(curr.get_childs());
72 }
73 None
74 }
75
76 /// find the source code location range of the FuntionDecl specified with name of fd_name.
77 /// The range starts from type declaration and ends with the end of function name.

Callers 2

get_fd_locMethod · 0.80
get_fd_param_locMethod · 0.80

Calls 6

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

Tested by

no test coverage detected