[PATCH] D144037: [clang-tidy] allow tests to use --config-file instead of --config

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 20 11:07:11 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG38b1a17c519d: [clang-tidy] allow tests to use --config-file instead of --config (authored by amurzeau, committed by PiotrZSL).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144037/new/

https://reviews.llvm.org/D144037

Files:
  clang-tools-extra/test/clang-tidy/check_clang_tidy.py
  clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-cfgfile.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation.cpp


Index: clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation.cpp
@@ -1,5 +1,4 @@
-// RUN: clang-tidy %s --config-file=%S/Inputs/identifier-naming/hungarian-notation2/.clang-tidy 2>&1 \
-// RUN:   | FileCheck -check-prefixes=CHECK-MESSAGES %s
+// RUN: %check_clang_tidy %s readability-identifier-naming %t -- --config-file=%S/Inputs/identifier-naming/hungarian-notation1/.clang-tidy
 
 // clang-format off
 typedef signed char         int8_t;     // NOLINT
Index: clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-cfgfile.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-cfgfile.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-cfgfile.cpp
@@ -1,5 +1,4 @@
-// RUN: clang-tidy %s --config-file=%S/Inputs/identifier-naming/hungarian-notation1/.clang-tidy 2>&1 \
-// RUN:   | FileCheck -check-prefixes=CHECK-MESSAGES %s
+// RUN: %check_clang_tidy %s readability-identifier-naming %t -- --config-file=%S/Inputs/identifier-naming/hungarian-notation2/.clang-tidy
 
 // clang-format off
 typedef signed char         int8_t;     // NOLINT
Index: clang-tools-extra/test/clang-tidy/check_clang_tidy.py
===================================================================
--- clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -107,9 +107,10 @@
     # If the test does not specify a config style, force an empty one; otherwise
     # auto-detection logic can discover a ".clang-tidy" file that is not related to
     # the test.
-    if not any(
-        [arg.startswith('-config=') for arg in self.clang_tidy_extra_args]):
-      self.clang_tidy_extra_args.append('-config={}')
+    if not any([
+        re.match('^-?-config(-file)?=', arg)
+        for arg in self.clang_tidy_extra_args]):
+      self.clang_tidy_extra_args.append('--config={}')
 
     if extension in ['.m', '.mm']:
       self.clang_extra_args = ['-fobjc-abi-version=2', '-fobjc-arc', '-fblocks'] + \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144037.498913.patch
Type: text/x-patch
Size: 2442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230220/3563d2fd/attachment.bin>


More information about the cfe-commits mailing list