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

Function _CheckNoInlineHeaderIncludesInNormalHeaders

deps/v8/PRESUBMIT.py:341–369  ·  view source on GitHub ↗

Attempts to prevent inclusion of inline headers into normal header files. This tries to establish a layering where inline headers can be included by other inline headers or compilation units only.

(input_api, output_api)

Source from the content-addressed store, hash-verified

339
340
341def _CheckNoInlineHeaderIncludesInNormalHeaders(input_api, output_api):
342 """Attempts to prevent inclusion of inline headers into normal header
343 files. This tries to establish a layering where inline headers can be
344 included by other inline headers or compilation units only."""
345 file_inclusion_pattern = r'(?!.+-inl\.h).+\.h'
346 include_directive_pattern = input_api.re.compile(r'#include ".+-inl.h"')
347 include_error = (
348 'You are including an inline header (e.g. foo-inl.h) within a normal\n'
349 'header (e.g. bar.h) file. This violates layering of dependencies.')
350
351 def FilterFile(affected_file):
352 files_to_skip = _EXCLUDED_PATHS + input_api.DEFAULT_FILES_TO_SKIP
353 return input_api.FilterSourceFile(
354 affected_file,
355 files_to_check=(file_inclusion_pattern, ),
356 files_to_skip=files_to_skip)
357
358 problems = []
359 for f in input_api.AffectedSourceFiles(FilterFile):
360 local_path = f.LocalPath()
361 for line_number, line in f.ChangedContents():
362 if (include_directive_pattern.search(line)):
363 problems.append('{}:{}\n {}'.format(local_path, line_number,
364 line.strip()))
365
366 if problems:
367 return [output_api.PresubmitError(include_error, problems)]
368 else:
369 return []
370
371
372def _CheckInlineHeadersIncludeNonInlineHeadersFirst(input_api, output_api):

Callers

nothing calls this directly

Calls 6

LocalPathMethod · 0.80
ChangedContentsMethod · 0.80
formatMethod · 0.65
compileMethod · 0.45
searchMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…