[libc++] NFCI: Remove dead code in the Lit configuration

I was trying to fix something else and I stumbled upon several methods
that are not used anymore in target_info.py.

Differential Revision: https://reviews.llvm.org/D98896
This commit is contained in:
Louis Dionne 2021-03-18 14:05:25 -07:00
parent e27654f737
commit 976eba51d0

View File

@ -21,18 +21,12 @@ class DefaultTargetInfo(object):
self.full_config = full_config
self.executor = None
def platform(self):
return sys.platform.lower().strip()
def is_windows(self):
return False
def is_mingw(self):
return False
def is_darwin(self):
return False
def add_cxx_flags(self, flags): pass
def add_cxx_compile_flags(self, flags): pass
def add_cxx_link_flags(self, flags): pass
@ -53,33 +47,6 @@ class DarwinLocalTI(DefaultTargetInfo):
def __init__(self, full_config):
super(DarwinLocalTI, self).__init__(full_config)
def is_darwin(self):
return True
def is_host_macosx(self):
name = lit.util.to_string(subprocess.check_output(['sw_vers', '-productName'])).strip()
return name == "Mac OS X"
def get_macosx_version(self):
assert self.is_host_macosx()
version = lit.util.to_string(subprocess.check_output(['sw_vers', '-productVersion'])).strip()
version = re.sub(r'([0-9]+\.[0-9]+)(\..*)?', r'\1', version)
return version
def get_sdk_version(self, name):
assert self.is_host_macosx()
cmd = ['xcrun', '--sdk', name, '--show-sdk-path']
try:
out = subprocess.check_output(cmd).strip()
except OSError:
pass
if not out:
self.full_config.lit_config.fatal(
"cannot infer sdk version with: %r" % cmd)
return re.sub(r'.*/[^0-9]+([0-9.]+)\.sdk', r'\1', out)
def add_cxx_flags(self, flags):
out, err, exit_code = executeCommand(['xcrun', '--show-sdk-path'])
if exit_code != 0:
@ -120,31 +87,6 @@ class LinuxLocalTI(DefaultTargetInfo):
def __init__(self, full_config):
super(LinuxLocalTI, self).__init__(full_config)
def platform(self):
return 'linux'
def _distribution(self):
try:
# linux_distribution is not available since Python 3.8
# However, this function is only used to detect SLES 11,
# which is quite an old distribution that doesn't have
# Python 3.8.
return platform.linux_distribution()
except AttributeError:
return '', '', ''
def platform_name(self):
name, _, _ = self._distribution()
# Some distros have spaces, e.g. 'SUSE Linux Enterprise Server'
# lit features can't have spaces
name = name.lower().strip().replace(' ', '-')
return name # Permitted to be None
def platform_ver(self):
_, ver, _ = self._distribution()
ver = ver.lower().strip().replace(' ', '-')
return ver # Permitted to be None.
def add_cxx_compile_flags(self, flags):
flags += ['-D__STDC_FORMAT_MACROS',
'-D__STDC_LIMIT_MACROS',