[libcxx-commits] [PATCH] D120087: [libc++] Check clang-tidy version

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 17 13:52:09 PST 2022


philnik created this revision.
philnik added reviewers: ldionne, Quuxplusone, Mordante.
Herald added a subscriber: arichardson.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120087

Files:
  libcxx/utils/libcxx/test/dsl.py
  libcxx/utils/libcxx/test/features.py


Index: libcxx/utils/libcxx/test/features.py
===================================================================
--- libcxx/utils/libcxx/test/features.py
+++ libcxx/utils/libcxx/test/features.py
@@ -84,7 +84,7 @@
   Feature(name='executor-has-no-bash',
           when=lambda cfg: runScriptExitCode(cfg, ['%{exec} bash -c \'bash --version\'']) != 0),
   Feature(name='has-clang-tidy',
-          when=lambda cfg: runScriptExitCode(cfg, ['clang-tidy --version']) == 0),
+          when=lambda cfg: runCommandGetVersion(cfg, ['clang-tidy --version']) >= 13),
 
   Feature(name='apple-clang',                                                                                                      when=_isAppleClang),
   Feature(name=lambda cfg: 'apple-clang-{__clang_major__}'.format(**compilerMacros(cfg)),                                          when=_isAppleClang),
Index: libcxx/utils/libcxx/test/dsl.py
===================================================================
--- libcxx/utils/libcxx/test/dsl.py
+++ libcxx/utils/libcxx/test/dsl.py
@@ -201,6 +201,14 @@
     _, _, exitCode, _ = _executeScriptInternal(test, script)
     return exitCode
 
+ at _memoizeExpensiveOperation(lambda c, s: (c.substitutions, c.environment, s))
+def runCommandGetVersion(config, command):
+  with _makeConfigTest(config) as test:
+    out, _, exitCode, _ = _executeScriptInternal(test, command)
+    if exitCode != 0:
+     return -1
+    return int(re.search('[0-9]+', out).group())
+
 @_memoizeExpensiveOperation(lambda c, l: (c.substitutions, c.environment, l))
 def hasAnyLocale(config, locales):
   """


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120087.409780.patch
Type: text/x-patch
Size: 1591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220217/979d86b8/attachment.bin>


More information about the libcxx-commits mailing list