diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index ec0e73b8f..24d9c642d 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -1275,6 +1275,36 @@ def simpleMatch(token, pattern): token = token.next return True +def get_function_call_name_args(token): + """Get function name and arguments for function call + name, args = get_function_call_name_args(tok) + """ + if token is None: + return None, None + if not token.isName or not token.scope.isExecutable: + return None, None + if not simpleMatch(token.next, '('): + return None, None + if token.function: + nametok = token.function.token + if token in (token.function.token, token.function.tokenDef): + return None, None + name = nametok.str + while nametok.previous and nametok.previous.previous and nametok.previous.str == '::' and nametok.previous.previous.isName: + name = nametok.previous.previous.str + '::' + name + nametok = nametok.previous.previous + scope = token.function.nestedIn + while scope: + if scope.className: + name = scope.className + '::' + name + scope = scope.nestedIn + else: + nametok = token + name = nametok.str + while nametok.previous and nametok.previous.previous and nametok.previous.str == '::' and nametok.previous.previous.isName: + name = nametok.previous.previous.str + '::' + name + nametok = nametok.previous.previous + return name, getArguments(token) def is_suppressed(location, message, errorId): for suppression in current_dumpfile_suppressions: