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

Method get_var_init_call

src/ast/kind.rs:241–256  ·  view source on GitHub ↗

if this variable is initialized by a call, return this call.

(&self, visitor: &'a Visitor)

Source from the content-addressed store, hash-verified

239
240 // if this variable is initialized by a call, return this call.
241 pub fn get_var_init_call<'a>(&self, visitor: &'a Visitor) -> Option<&'a Node> {
242 if let Some(init) = self.get_var_init(visitor) {
243 let init = init.ignore_parent().ignore_cast();
244 if matches!(&init.kind, Clang::CallExpr(_) | Clang::CXXNewExpr(_)) {
245 return Some(init);
246 }
247 }
248 let var_name = self.get_name_as_string();
249 if let Some(bo_right) = visitor.find_binary_operator(&var_name) {
250 let init = bo_right.ignore_parent().ignore_cast();
251 if matches!(&init.kind, Clang::CallExpr(_)) {
252 return Some(init);
253 }
254 }
255 None
256 }
257}
258
259#[derive(Deserialize, Debug, Clone, Default)]

Callers 1

is_alloc_size_of_varFunction · 0.80

Calls 5

get_var_initMethod · 0.80
ignore_castMethod · 0.80
ignore_parentMethod · 0.80
get_name_as_stringMethod · 0.80
find_binary_operatorMethod · 0.80

Tested by

no test coverage detected