MCPcopy Index your code
hub / github.com/python/cpython / preprocess

Function preprocess

Tools/c-analyzer/c_parser/preprocessor/clang.py:17–47  ·  view source on GitHub ↗
(filename,
               incldirs=None,
               includes=None,
               macros=None,
               samefiles=None,
               cwd=None,
               )

Source from the content-addressed store, hash-verified

15
16
17def preprocess(filename,
18 incldirs=None,
19 includes=None,
20 macros=None,
21 samefiles=None,
22 cwd=None,
23 ):
24 if not cwd or not os.path.isabs(cwd):
25 cwd = os.path.abspath(cwd or '.')
26 filename = _normpath(filename, cwd)
27
28 postargs = _gcc.POST_ARGS
29 basename = os.path.basename(filename)
30 dirname = os.path.basename(os.path.dirname(filename))
31 if (basename not in _gcc.FILES_WITHOUT_INTERNAL_CAPI
32 and dirname not in _gcc.DIRS_WITHOUT_INTERNAL_CAPI):
33 postargs += ('-DPy_BUILD_CORE=1',)
34
35 text = _common.preprocess(
36 TOOL,
37 filename,
38 incldirs=incldirs,
39 includes=includes,
40 macros=macros,
41 #preargs=PRE_ARGS,
42 postargs=postargs,
43 executable=['clang'],
44 compiler='unix',
45 cwd=cwd,
46 )
47 return _iter_lines(text, filename, samefiles, cwd)
48
49
50EXIT_MARKERS = {'# 2 "<built-in>" 2', '# 3 "<built-in>" 2', '# 4 "<built-in>" 2'}

Callers

nothing calls this directly

Calls 7

_normpathFunction · 0.85
_iter_linesFunction · 0.70
isabsMethod · 0.45
abspathMethod · 0.45
basenameMethod · 0.45
dirnameMethod · 0.45
preprocessMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…