[PATCH] D59160: lit: Remove the binary_feature function and inline it everywhere.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 14:48:35 PST 2019


pcc created this revision.
pcc added a reviewer: zturner.
Herald added a subscriber: delcypher.
Herald added a reviewer: serge-sans-paille.
Herald added a project: LLVM.
pcc updated this revision to Diff 189944.
pcc added a comment.

- Fix typo


This is not only less code but makes the feature names easier to grep for.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59160

Files:
  llvm/utils/lit/lit/llvm/config.py


Index: llvm/utils/lit/lit/llvm/config.py
===================================================================
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -9,10 +9,6 @@
 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,12 @@
         # 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_'))
+        features.add('asan' if 'address' in sanitizers else 'not_asan')
+        features.add('msan' if 'memory' in sanitizers else 'not_msan')
+        features.add('ubsan' if 'undefined' in sanitizers else 'not_ubsan')
 
         have_zlib = getattr(config, 'have_zlib', None)
-        features.add(binary_feature(have_zlib, 'zlib', 'no'))
+        features.add('zlib' if have_zlib else 'nozlib')
 
         # Check if we should run long running tests.
         long_tests = lit_config.params.get('run_long_tests', None)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59160.189944.patch
Type: text/x-patch
Size: 1378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190308/93d1f149/attachment.bin>


More information about the llvm-commits mailing list