[NFC][LLVM][CodeGen] Move LiveDebugVariables.h into llvm/include/llvm/CodeGen (#88374)
[llvm-project.git] / lldb / packages / Python / lldbsuite / support / gmodules.py
blob81185a56422667d777bbbe2b3ae14af597a111b6
1 # System modules
2 import os
3 import re
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:
18 return False
19 else:
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]