forked from OSchip/llvm-project
[libc++] Provide a method for adding compiler flags in lit.local.cfg files
That way, local lit configuration files don't have to worry about deep-copying the compiler instance of the test format, which is arguably an implementation detail. We pass the config to this method even though it is not used by the current test format because this allows replacing the current test format by other test formats that would require the config to add new compile flags.
This commit is contained in:
parent
d3a729ab24
commit
fb47ffc618
|
@ -1 +1 @@
|
||||||
config.test_format.cxx.compile_flags += ['-D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM']
|
config.test_format.addCompileFlags(config, '-D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM')
|
||||||
|
|
|
@ -4,6 +4,4 @@
|
||||||
if 'fcoroutines-ts' not in config.available_features:
|
if 'fcoroutines-ts' not in config.available_features:
|
||||||
config.unsupported = True
|
config.unsupported = True
|
||||||
else:
|
else:
|
||||||
import copy
|
config.test_format.addCompileFlags(config, '-fcoroutines-ts')
|
||||||
config.test_format.cxx = copy.deepcopy(config.test_format.cxx)
|
|
||||||
config.test_format.cxx.compile_flags += ['-fcoroutines-ts']
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import copy
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -8,11 +7,9 @@ if 'dylib-has-no-filesystem' in config.available_features:
|
||||||
if 'c++filesystem-disabled' in config.available_features:
|
if 'c++filesystem-disabled' in config.available_features:
|
||||||
config.unsupported = True
|
config.unsupported = True
|
||||||
|
|
||||||
config.test_format.cxx = copy.deepcopy(config.test_format.cxx)
|
|
||||||
|
|
||||||
inputs = os.path.join(os.path.dirname(__file__), 'Inputs', 'static_test_env')
|
inputs = os.path.join(os.path.dirname(__file__), 'Inputs', 'static_test_env')
|
||||||
config.test_format.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="{}"'.format(inputs)]
|
config.test_format.addCompileFlags(config, '-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="{}"'.format(inputs))
|
||||||
|
|
||||||
dynamic_helper = os.path.join(config.test_source_root, 'support', 'filesystem_dynamic_test_helper.py')
|
dynamic_helper = os.path.join(config.test_source_root, 'support', 'filesystem_dynamic_test_helper.py')
|
||||||
assert os.path.isfile(dynamic_helper)
|
assert os.path.isfile(dynamic_helper)
|
||||||
config.test_format.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="{} {}"'.format(sys.executable, dynamic_helper)]
|
config.test_format.addCompileFlags(config, '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="{} {}"'.format(sys.executable, dynamic_helper))
|
||||||
|
|
|
@ -51,6 +51,11 @@ class LibcxxTestFormat(object):
|
||||||
initial_value=[])
|
initial_value=[])
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Utility function to add compile flags in lit.local.cfg files.
|
||||||
|
def addCompileFlags(self, config, *flags):
|
||||||
|
self.cxx = copy.deepcopy(self.cxx)
|
||||||
|
self.cxx.compile_flags += flags
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_parser(key, parsers):
|
def _get_parser(key, parsers):
|
||||||
for p in parsers:
|
for p in parsers:
|
||||||
|
|
Loading…
Reference in New Issue