2 * smatch/smatch_function_ptrs.c
4 * Copyright (C) 2013 Oracle.
6 * Licensed under the Open Software License version 1.1
11 * Track how functions are saved as various struct members or passed as
17 #include "smatch_slist.h"
21 static void match_function_assign(struct expression
*expr
)
23 struct expression
*right
= expr
->right
;
28 if (right
->type
== EXPR_PREOP
&& right
->op
== '&')
29 right
= strip_expr(right
->unop
);
30 if (right
->type
!= EXPR_SYMBOL
)
32 sym
= get_type(right
);
33 if (!sym
|| sym
->type
!= SYM_FN
)
36 fn_name
= expr_to_var(right
);
37 ptr_name
= get_fnptr_name(expr
->left
);
38 if (!fn_name
|| !ptr_name
)
41 sql_insert_function_ptr(fn_name
, ptr_name
);
45 free_string(ptr_name
);
48 void register_function_ptrs(int id
)
55 add_hook(&match_function_assign
, ASSIGNMENT_HOOK
);