[libcxx-commits] [libcxx] db015fd - [libc++] Translate compiler-identification Lit features to the new DSL
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon May 4 08:03:30 PDT 2020
Author: Louis Dionne
Date: 2020-05-04T11:02:38-04:00
New Revision: db015fdd2061714224f0ba46a10db28e90df8f7d
URL: https://github.com/llvm/llvm-project/commit/db015fdd2061714224f0ba46a10db28e90df8f7d
DIFF: https://github.com/llvm/llvm-project/commit/db015fdd2061714224f0ba46a10db28e90df8f7d.diff
LOG: [libc++] Translate compiler-identification Lit features to the new DSL
Added:
Modified:
libcxx/utils/libcxx/test/config.py
libcxx/utils/libcxx/test/features.py
Removed:
################################################################################
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 5713c5ebba5d..dad44966dfb0 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -221,16 +221,6 @@ def configure_cxx(self):
'(e.g., --param=cxx_under_test=clang++)')
self.cxx = CXXCompiler(self, cxx) if not self.cxx_is_clang_cl else \
self._configure_clang_cl(cxx)
- cxx_type = self.cxx.type
- if cxx_type is not None:
- assert self.cxx.version is not None
- maj_v, min_v, patch_v = self.cxx.version
- self.config.available_features.add(cxx_type)
- self.config.available_features.add('%s-%s' % (cxx_type, maj_v))
- self.config.available_features.add('%s-%s.%s' % (
- cxx_type, maj_v, min_v))
- self.config.available_features.add('%s-%s.%s.%s' % (
- cxx_type, maj_v, min_v, patch_v))
self.cxx.compile_env = dict(os.environ)
# 'CCACHE_CPP2' prevents ccache from stripping comments while
# preprocessing. This is required to prevent stripping of '-verify'
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 091fffa599a5..7bdb9216787a 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -9,6 +9,10 @@
from libcxx.test.dsl import *
import sys
+_isClang = lambda cfg: '__clang__' in compilerMacros(cfg) and '__apple_build_version__' not in compilerMacros(cfg)
+_isAppleClang = lambda cfg: '__apple_build_version__' in compilerMacros(cfg)
+_isGCC = lambda cfg: '__GNUC__' in compilerMacros(cfg) and '__clang__' not in compilerMacros(cfg)
+
features = [
Feature(name='fcoroutines-ts', compileFlag='-fcoroutines-ts',
when=lambda cfg: hasCompileFlag(cfg, '-fcoroutines-ts') and
@@ -27,4 +31,19 @@
sys.platform.lower().strip() == 'darwin'), # TODO: this doesn't handle cross-compiling to Apple platforms.
Feature(name='objective-c++', when=lambda cfg: hasCompileFlag(cfg, '-xobjective-c++ -fobjc-arc')),
Feature(name='diagnose-if-support', when=lambda cfg: hasCompileFlag(cfg, '-Wuser-defined-warnings'), compileFlag='-Wuser-defined-warnings'),
+
+ Feature(name='apple-clang', when=_isAppleClang),
+ Feature(name=lambda cfg: 'apple-clang-{__clang_major__}'.format(**compilerMacros(cfg)), when=_isAppleClang),
+ Feature(name=lambda cfg: 'apple-clang-{__clang_major__}.{__clang_minor__}'.format(**compilerMacros(cfg)), when=_isAppleClang),
+ Feature(name=lambda cfg: 'apple-clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}'.format(**compilerMacros(cfg)), when=_isAppleClang),
+
+ Feature(name='clang', when=_isClang),
+ Feature(name=lambda cfg: 'clang-{__clang_major__}'.format(**compilerMacros(cfg)), when=_isClang),
+ Feature(name=lambda cfg: 'clang-{__clang_major__}.{__clang_minor__}'.format(**compilerMacros(cfg)), when=_isClang),
+ Feature(name=lambda cfg: 'clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}'.format(**compilerMacros(cfg)), when=_isClang),
+
+ Feature(name='gcc', when=_isGCC),
+ Feature(name=lambda cfg: 'gcc-{__GNUC__}'.format(**compilerMacros(cfg)), when=_isGCC),
+ Feature(name=lambda cfg: 'gcc-{__GNUC__}.{__GNUC_MINOR__}'.format(**compilerMacros(cfg)), when=_isGCC),
+ Feature(name=lambda cfg: 'gcc-{__GNUC__}.{__GNUC_MINOR__}.{__GNUC_PATCHLEVEL__}'.format(**compilerMacros(cfg)), when=_isGCC),
]
More information about the libcxx-commits
mailing list