MCPcopy Index your code
hub / github.com/nodejs/node / FindCheckMacro

Function FindCheckMacro

tools/cpplint.py:5277–5297  ·  view source on GitHub ↗

Find a replaceable CHECK-like macro. Args: line: line to search on. Returns: (macro name, start position), or (None, -1) if no replaceable macro is found.

(line)

Source from the content-addressed store, hash-verified

5275
5276
5277def FindCheckMacro(line):
5278 """Find a replaceable CHECK-like macro.
5279
5280 Args:
5281 line: line to search on.
5282 Returns:
5283 (macro name, start position), or (None, -1) if no replaceable
5284 macro is found.
5285 """
5286 for macro in _CHECK_MACROS:
5287 i = line.find(macro)
5288 if i >= 0:
5289 # Find opening parenthesis. Do a regular expression match here
5290 # to make sure that we are matching the expected CHECK macro, as
5291 # opposed to some other macro that happens to contain the CHECK
5292 # substring.
5293 matched = re.match(r"^(.*\b" + macro + r"\s*)\(", line)
5294 if not matched:
5295 continue
5296 return (macro, len(matched.group(1)))
5297 return (None, -1)
5298
5299
5300def CheckCheck(filename, clean_lines, linenum, error):

Callers 1

CheckCheckFunction · 0.85

Calls 2

findMethod · 0.65
matchMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…