6 GMODULES_SUPPORT_MAP
= {}
7 GMODULES_HELP_REGEX
= re
.compile(r
"\s-gmodules\s")
10 def is_compiler_clang_with_gmodules(compiler_path
):
11 # Before computing the result, check if we already have it cached.
12 if compiler_path
in GMODULES_SUPPORT_MAP
:
13 return GMODULES_SUPPORT_MAP
[compiler_path
]
15 def _gmodules_supported_internal():
16 compiler
= os
.path
.basename(compiler_path
)
17 if "clang" not in compiler
:
20 # Check the compiler help for the -gmodules option.
21 clang_help
= os
.popen("%s --help" % compiler_path
).read()
22 return GMODULES_HELP_REGEX
.search(clang_help
, re
.DOTALL
) is not None
24 GMODULES_SUPPORT_MAP
[compiler_path
] = _gmodules_supported_internal()
25 return GMODULES_SUPPORT_MAP
[compiler_path
]