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

Function UpdateIncludeState

util/cpplint.py:5393–5417  ·  view source on GitHub ↗

Fill up the include_dict with new includes found from the file. Args: filename: the name of the header to read. include_dict: a dictionary in which the headers are inserted. io: The io factory to use to read the file. Provided for testability. Returns: True if a header was succ

(filename, include_dict, io=codecs)

Source from the content-addressed store, hash-verified

5391
5392
5393def UpdateIncludeState(filename, include_dict, io=codecs):
5394 """Fill up the include_dict with new includes found from the file.
5395
5396 Args:
5397 filename: the name of the header to read.
5398 include_dict: a dictionary in which the headers are inserted.
5399 io: The io factory to use to read the file. Provided for testability.
5400
5401 Returns:
5402 True if a header was successfully added. False otherwise.
5403 """
5404 headerfile = None
5405 try:
5406 headerfile = io.open(filename, 'r', 'utf8', 'replace')
5407 except IOError:
5408 return False
5409 linenum = 0
5410 for line in headerfile:
5411 linenum += 1
5412 clean_line = CleanseComments(line)
5413 match = _RE_PATTERN_INCLUDE.search(clean_line)
5414 if match:
5415 include = match.group(2)
5416 include_dict.setdefault(include, linenum)
5417 return True
5418
5419
5420def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,

Callers 1

Calls 1

CleanseCommentsFunction · 0.85

Tested by

no test coverage detected