MCPcopy Create free account
hub / github.com/Persper/code-analytics / handle_call

Function handle_call

persper/graphs/call_graph/c.py:47–67  ·  view source on GitHub ↗

Given an node, return function name being called Throws NotFunctionCallException Case 1: casting function pointer is not function call Example: tmp.sa_handler = (void (*)(int)) handler; Case 2: function call from struct variable Example: tty->write(tty)

(call_node)

Source from the content-addressed store, hash-verified

45
46
47def handle_call(call_node):
48 """Given an <call> node, return function name being called
49
50 Throws NotFunctionCallException
51
52 Case 1: casting function pointer is not function call
53 Example: tmp.sa_handler = (void (*)(int)) handler;
54
55 Case 2: function call from struct variable
56 Example: tty->write(tty)
57
58 """
59 name_node = call_node.find('srcml:name', ns)
60 if name_node is None:
61 # Case 1
62 raise NotFunctionCallError()
63 callee_name = name_node.text
64 if callee_name is None:
65 # Case 2
66 callee_name = name_node[-1].text
67 return callee_name
68
69
70def build_call_graph_c(roots, G=None):

Callers 1

build_call_graph_cFunction · 0.70

Calls 1

Tested by

no test coverage detected