forked from llvm/llvm-project
- Notifications
You must be signed in to change notification settings - Fork 339
/
Copy pathgmodules.py
25 lines (19 loc) · 841 Bytes
/
gmodules.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# System modules
importos
importre
GMODULES_SUPPORT_MAP= {}
GMODULES_HELP_REGEX=re.compile(r"\s-gmodules\s")
defis_compiler_clang_with_gmodules(compiler_path):
# Before computing the result, check if we already have it cached.
ifcompiler_pathinGMODULES_SUPPORT_MAP:
returnGMODULES_SUPPORT_MAP[compiler_path]
def_gmodules_supported_internal():
compiler=os.path.basename(compiler_path)
if"clang"notincompiler:
returnFalse
else:
# Check the compiler help for the -gmodules option.
clang_help=os.popen("%s --help"%compiler_path).read()
returnGMODULES_HELP_REGEX.search(clang_help, re.DOTALL) isnotNone
GMODULES_SUPPORT_MAP[compiler_path] =_gmodules_supported_internal()
returnGMODULES_SUPPORT_MAP[compiler_path]