Author: Zeyi Xu
Date: 2026-05-07T07:49:08Z
New Revision: e01ea6ce12642e6563cc8b04c6d119ac5a889fba

URL: 
https://github.com/llvm/llvm-project/commit/e01ea6ce12642e6563cc8b04c6d119ac5a889fba
DIFF: 
https://github.com/llvm/llvm-project/commit/e01ea6ce12642e6563cc8b04c6d119ac5a889fba.diff

LOG: [clang-tidy] Reject malformed -std spellings in `check_clang_tidy.py`. 
NFC. (#195609)

`check_clang_tidy.py` expanded any `-std` value containing `-or-later`,
even when extra text followed the suffix. e.g. `c++20-or-latermisc` was
treated like `c++20-or-later`.

This commit requires `-or-later` to be the actual end of the spelling
before expanding it, so malformed values are passed through and
diagnosed by clang.

Added: 
    

Modified: 
    clang-tools-extra/test/clang-tidy/check_clang_tidy.py

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py 
b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
index 71c072e62e3f2..7bd9647a66e89 100755
--- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -460,7 +460,11 @@ def run(self) -> None:
 
 
 def expand_std(std: str) -> List[str]:
-    split_std, or_later, _ = std.partition("-or-later")
+    split_std, or_later, suffix = std.partition("-or-later")
+
+    if or_later and suffix:
+        # Keep malformed -or-later spellings unchanged so clang diagnoses them.
+        return [std]
 
     if not or_later:
         return [split_std]


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to