addons/cppcheckdata.py: Add 'cppcheckdata.getArguments' function

This commit is contained in:
Daniel Marjamäki 2019-06-23 13:54:33 +02:00
parent 1b4485a738
commit 63bd29d644
1 changed files with 19 additions and 0 deletions

View File

@ -757,6 +757,25 @@ class CppcheckData:
self.configurations.append(Configuration(cfgnode))
# Get function arguments
def getArgumentsRecursive(tok, arguments):
if tok is None:
return
if tok.str == ',':
getArgumentsRecursive(tok.astOperand1, arguments)
getArgumentsRecursive(tok.astOperand2, arguments)
else:
arguments.append(tok)
def getArguments(ftok):
if (not ftok.isName) or (ftok.next is None) or ftok.next.str != '(':
return None
args = []
getArgumentsRecursive(ftok.next.astOperand2, args)
return args
def parsedump(filename):
"""
parse a cppcheck dump file