MCPcopy Create free account
hub / github.com/tensorflow/tfjs / FindCheckMacro

Function FindCheckMacro

tfjs-backend-wasm/tools/cpplint.py:4106–4126  ·  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

4104
4105
4106def FindCheckMacro(line):
4107 """Find a replaceable CHECK-like macro.
4108
4109 Args:
4110 line: line to search on.
4111 Returns:
4112 (macro name, start position), or (None, -1) if no replaceable
4113 macro is found.
4114 """
4115 for macro in _CHECK_MACROS:
4116 i = line.find(macro)
4117 if i >= 0:
4118 # Find opening parenthesis. Do a regular expression match here
4119 # to make sure that we are matching the expected CHECK macro, as
4120 # opposed to some other macro that happens to contain the CHECK
4121 # substring.
4122 matched = Match(r'^(.*\b' + macro + r'\s*)\(', line)
4123 if not matched:
4124 continue
4125 return (macro, len(matched.group(1)))
4126 return (None, -1)
4127
4128
4129def CheckCheck(filename, clean_lines, linenum, error):

Callers 1

CheckCheckFunction · 0.85

Calls 2

MatchFunction · 0.85
findMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…