MCPcopy Index your code
hub / github.com/cpplint/cpplint / IsDerivedFunction

Function IsDerivedFunction

cpplint.py:6234–6251  ·  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

6232
6233
6234def IsDerivedFunction(clean_lines, linenum):
6235 """Check if current line contains an inherited function.
6236
6237 Args:
6238 clean_lines: A CleansedLines instance containing the file.
6239 linenum: The number of the line to check.
6240 Returns:
6241 True if current line contains a function with "override"
6242 virt-specifier.
6243 """
6244 # Scan back a few lines for start of current function
6245 for i in range(linenum, max(-1, linenum - 10), -1):
6246 match = re.match(r"^([^()]*\w+)\(", clean_lines.elided[i])
6247 if match:
6248 # Look for "override" after the matching closing parenthesis
6249 line, _, closing_paren = CloseExpression(clean_lines, i, len(match.group(1)))
6250 return closing_paren >= 0 and re.search(r"\boverride\b", line[closing_paren:])
6251 return False
6252
6253
6254def IsOutOfLineMethodDefinition(clean_lines, linenum):

Callers 1

Calls 1

CloseExpressionFunction · 0.85

Tested by

no test coverage detected