[libcxx-commits] [libcxx] 01a0c3b - [libc++] Define the no-exceptions Lit feature using the DSL
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 10 05:14:07 PDT 2020
Author: Louis Dionne
Date: 2020-06-10T08:03:51-04:00
New Revision: 01a0c3b49aa2030d0da789e71e8ecf880284b89a
URL: https://github.com/llvm/llvm-project/commit/01a0c3b49aa2030d0da789e71e8ecf880284b89a
DIFF: https://github.com/llvm/llvm-project/commit/01a0c3b49aa2030d0da789e71e8ecf880284b89a.diff
LOG: [libc++] Define the no-exceptions Lit feature using the DSL
Instead of using logic in config.py, use the DSL to grab the no-exceptions
user-configurable parameter from the Lit command-line invocation.
Added:
libcxx/utils/libcxx/test/params.py
Modified:
libcxx/utils/libcxx/test/config.py
Removed:
################################################################################
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 35dac0df5682..ec673da4a6b3 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -22,6 +22,7 @@
from libcxx.test.tracing import *
import libcxx.util
import libcxx.test.features
+import libcxx.test.params
def loadSiteConfig(lit_config, config, param_name, env_name):
# We haven't loaded the site specific configuration (the user is
@@ -141,6 +142,7 @@ def configure(self):
self.configure_modules()
self.configure_substitutions()
self.configure_features()
+ self.configure_new_params()
self.configure_new_features()
def configure_new_features(self):
@@ -148,6 +150,12 @@ def configure_new_features(self):
for feature in supportedFeatures:
feature.enableIn(self.config)
+ def configure_new_params(self):
+ for param in libcxx.test.params.parameters:
+ feature = param.getFeature(self.config, self.lit_config.params)
+ if feature:
+ feature.enableIn(self.config)
+
def print_config_info(self):
# Print the final compile and link flags.
self.lit_config.note('Using compiler: %s' % self.cxx.path)
@@ -391,7 +399,6 @@ def configure_default_compile_flags(self):
self.configure_compile_flags_header_includes()
self.target_info.add_cxx_compile_flags(self.cxx.compile_flags)
# Configure feature flags.
- self.configure_compile_flags_exceptions()
self.configure_compile_flags_rtti()
enable_32bit = self.get_lit_bool('enable_32bit', False)
if enable_32bit:
@@ -479,12 +486,6 @@ def configure_config_site_header(self):
return
self.cxx.compile_flags += ['-include', config_site_header]
- def configure_compile_flags_exceptions(self):
- enable_exceptions = self.get_lit_bool('enable_exceptions', True)
- if not enable_exceptions:
- self.config.available_features.add('no-exceptions')
- self.cxx.compile_flags += ['-fno-exceptions']
-
def configure_compile_flags_rtti(self):
enable_rtti = self.get_lit_bool('enable_rtti', True)
if not enable_rtti:
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
new file mode 100644
index 000000000000..9a42d74bdb03
--- /dev/null
+++ b/libcxx/utils/libcxx/test/params.py
@@ -0,0 +1,16 @@
+#===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===----------------------------------------------------------------------===##
+
+from libcxx.test.dsl import *
+
+parameters = [
+ Parameter(name='enable_exceptions', choices=[True, False], type=bool, default=True,
+ help="Whether to enable exceptions when compiling the test suite.",
+ feature=lambda exceptions: None if exceptions else
+ Feature(name='no-exceptions', compileFlag='-fno-exceptions')),
+]
More information about the libcxx-commits
mailing list