Files
James Gross 80de840881 Even More Syntax Cleanup (#293)
A lot of cleanup things in prep for a python 3 transition. Getting rid of the old exception syntax, converting prints over to logging, cutting random scraps of code to be proper unit tests,  cut away some older bits of code, etc.

This still works in python2. It's just a lot of tidying up. There are no major functionality changes.
2020-09-08 13:00:06 -04:00

26 lines
805 B
Python

"""
Function analysis module which sets function APIs based
on function's name matching impapi. This should ideally go
early in the module order to get the APIs marked asap.
"""
import logging
logger = logging.getLogger(__name__)
def analyzeFunction(vw, fva):
fname = vw.getName(fva)
filename = vw.getFileByVa(fva)
if fname.startswith(filename + "."):
fname = fname[len(filename)+1:]
api = vw.getImpApi(fname)
if api is None:
return
rettype, retname, callconv, callname, callargs = api
callargs = [callargs[i] if callargs[i][1] else (callargs[i][0], 'arg%d' % i) for i in range(len(callargs))]
funcapi = (rettype, retname, callconv, callname, callargs)
vw.setFunctionApi(fva, funcapi)
logger.debug("vw.setFunctionApi(0x%x, %r)", fva, funcapi)