[libcxx-commits] [libcxx] fb47ffc - [libc++] Provide a method for adding compiler flags in lit.local.cfg files
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 31 06:30:20 PDT 2020
Author: Louis Dionne
Date: 2020-03-31T09:29:18-04:00
New Revision: fb47ffc618eaf0e716eafa7e719fc67bf41cef3b
URL: https://github.com/llvm/llvm-project/commit/fb47ffc618eaf0e716eafa7e719fc67bf41cef3b
DIFF: https://github.com/llvm/llvm-project/commit/fb47ffc618eaf0e716eafa7e719fc67bf41cef3b.diff
LOG: [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.
Added:
Modified:
libcxx/test/std/experimental/filesystem/lit.local.cfg
libcxx/test/std/experimental/language.support/support.coroutines/lit.local.cfg
libcxx/test/std/input.output/filesystems/lit.local.cfg
libcxx/utils/libcxx/test/format.py
Removed:
################################################################################
diff --git a/libcxx/test/std/experimental/filesystem/lit.local.cfg b/libcxx/test/std/experimental/filesystem/lit.local.cfg
index 1d0cf19256ef..460a0b8f7a25 100644
--- a/libcxx/test/std/experimental/filesystem/lit.local.cfg
+++ b/libcxx/test/std/experimental/filesystem/lit.local.cfg
@@ -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')
diff --git a/libcxx/test/std/experimental/language.support/support.coroutines/lit.local.cfg b/libcxx/test/std/experimental/language.support/support.coroutines/lit.local.cfg
index a0b3de8afaa3..d32e99fc2721 100644
--- a/libcxx/test/std/experimental/language.support/support.coroutines/lit.local.cfg
+++ b/libcxx/test/std/experimental/language.support/support.coroutines/lit.local.cfg
@@ -4,6 +4,4 @@
if 'fcoroutines-ts' not in config.available_features:
config.unsupported = True
else:
- import copy
- config.test_format.cxx = copy.deepcopy(config.test_format.cxx)
- config.test_format.cxx.compile_flags += ['-fcoroutines-ts']
+ config.test_format.addCompileFlags(config, '-fcoroutines-ts')
diff --git a/libcxx/test/std/input.output/filesystems/lit.local.cfg b/libcxx/test/std/input.output/filesystems/lit.local.cfg
index f2f26e621fc8..00e149254859 100644
--- a/libcxx/test/std/input.output/filesystems/lit.local.cfg
+++ b/libcxx/test/std/input.output/filesystems/lit.local.cfg
@@ -1,4 +1,3 @@
-import copy
import os
import sys
@@ -8,11 +7,9 @@ if 'dylib-has-no-filesystem' in config.available_features:
if 'c++filesystem-disabled' in config.available_features:
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')
-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')
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))
diff --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py
index 4199ddd7f80b..6dabc03c2a7a 100644
--- a/libcxx/utils/libcxx/test/format.py
+++ b/libcxx/utils/libcxx/test/format.py
@@ -51,6 +51,11 @@ def _make_custom_parsers(test):
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
def _get_parser(key, parsers):
for p in parsers:
More information about the libcxx-commits
mailing list