MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / HandleFunctionDeclCursor

Function HandleFunctionDeclCursor

Scripts/DefinitionExtract.py:134–167  ·  view source on GitHub ↗
(Arch, Cursor)

Source from the content-addressed store, hash-verified

132FunctionDecls = []
133
134def HandleFunctionDeclCursor(Arch, Cursor):
135 if (Cursor.is_definition()):
136 return Arch
137
138 #logging.critical ("Unhandled FunctionDeclCursor {0}-{1}-{2}-{3}".format(Cursor.kind, Cursor.type.spelling, Cursor.spelling,
139 # Cursor.result_type.spelling))
140
141 Function = FunctionDecl(Cursor.spelling, Cursor.result_type.spelling)
142
143 for Child in Cursor.get_children():
144 if (Child.kind == CursorKind.TYPE_REF):
145 # This will give us the return type
146 # We skip this since we get it at the start instead
147 pass
148 elif (Child.kind == CursorKind.PARM_DECL):
149 # This gives us a parameter type
150 Function.Params.append(Child.type.spelling)
151 elif (Child.kind == CursorKind.ASM_LABEL_ATTR):
152 # Whatever you are we don't care about you
153 return Arch
154 elif (Child.kind == CursorKind.WARN_UNUSED_RESULT_ATTR):
155 # Whatever you are we don't care about you
156 return Arch
157 elif (Child.kind == CursorKind.VISIBILITY_ATTR or
158 Child.kind == CursorKind.UNEXPOSED_ATTR or
159 Child.kind == CursorKind.CONST_ATTR or
160 Child.kind == CursorKind.PURE_ATTR):
161 pass
162 else:
163 logging.critical ("\tUnhandled FunctionDeclCursor {0}-{1}-{2}".format(Child.kind, Child.type.spelling, Child.spelling))
164 sys.exit(-1)
165
166 FunctionDecls.append(Function)
167 return Arch
168
169def PrintFunctionDecls():
170 for Decl in FunctionDecls:

Callers 1

HandleCursorFunction · 0.85

Calls 3

FunctionDeclClass · 0.85
appendMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected