MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / IsDerivedFunction

Function IsDerivedFunction

util/cpplint.py:4855–4874  ·  view source on GitHub ↗

Check if current line contains an inherited function. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. Returns: True if current line contains a function with "override" virt-specifier.

(clean_lines, linenum)

Source from the content-addressed store, hash-verified

4853
4854
4855def IsDerivedFunction(clean_lines, linenum):
4856 """Check if current line contains an inherited function.
4857
4858 Args:
4859 clean_lines: A CleansedLines instance containing the file.
4860 linenum: The number of the line to check.
4861 Returns:
4862 True if current line contains a function with "override"
4863 virt-specifier.
4864 """
4865 # Scan back a few lines for start of current function
4866 for i in range(linenum, max(-1, linenum - 10), -1):
4867 match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i])
4868 if match:
4869 # Look for "override" after the matching closing parenthesis
4870 line, _, closing_paren = CloseExpression(
4871 clean_lines, i, len(match.group(1)))
4872 return (closing_paren >= 0 and
4873 Search(r'\boverride\b', line[closing_paren:]))
4874 return False
4875
4876
4877def IsOutOfLineMethodDefinition(clean_lines, linenum):

Callers 1

Calls 3

MatchFunction · 0.85
CloseExpressionFunction · 0.85
SearchFunction · 0.85

Tested by

no test coverage detected