[llvm] r360603 - Stop defining negative versions of some lit feature keywords:

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Mon May 13 10:18:58 PDT 2019


Author: probinson
Date: Mon May 13 10:18:58 2019
New Revision: 360603

URL: http://llvm.org/viewvc/llvm-project?rev=360603&view=rev
Log:
Stop defining negative versions of some lit feature keywords:
zlib/nozlib, asan/not_asan, msan/not_msan, ubsan/not_ubsan.

We still have two other ways to express the absence of a feature.
First, we have the '!' operator to invert the sense of a keyword.  For
example, given a feature that depends on zlib being unavailable, its
test can say:
    REQUIRES: !zlib

Second, if a test doesn't play well with some features, such as
sanitizers, that test can say:
    UNSUPPORTED: asan, msan

The different ways of writing these exclusions both have the same
technical effect, but have different implications to the reader.

Modified:
    llvm/trunk/utils/lit/lit/llvm/config.py

Modified: llvm/trunk/utils/lit/lit/llvm/config.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/llvm/config.py?rev=360603&r1=360602&r2=360603&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/llvm/config.py (original)
+++ llvm/trunk/utils/lit/lit/llvm/config.py Mon May 13 10:18:58 2019
@@ -9,10 +9,6 @@ from lit.llvm.subst import FindTool
 from lit.llvm.subst import ToolSubst
 
 
-def binary_feature(on, feature, off_prefix):
-    return feature if on else off_prefix + feature
-
-
 class LLVMConfig(object):
 
     def __init__(self, lit_config, config):
@@ -73,13 +69,16 @@ class LLVMConfig(object):
         # Sanitizers.
         sanitizers = getattr(config, 'llvm_use_sanitizer', '')
         sanitizers = frozenset(x.lower() for x in sanitizers.split(';'))
-        features.add(binary_feature('address' in sanitizers, 'asan', 'not_'))
-        features.add(binary_feature('memory' in sanitizers, 'msan', 'not_'))
-        features.add(binary_feature(
-            'undefined' in sanitizers, 'ubsan', 'not_'))
+        if 'address' in sanitizers:
+            features.add('asan')
+        if 'memory' in sanitizers:
+            features.add('msan')
+        if 'undefined' in sanitizers:
+            features.add('ubsan')
 
         have_zlib = getattr(config, 'have_zlib', None)
-        features.add(binary_feature(have_zlib, 'zlib', 'no'))
+        if have_zlib:
+            features.add('zlib')
 
         # Check if we should run long running tests.
         long_tests = lit_config.params.get('run_long_tests', None)




More information about the llvm-commits mailing list