https://github.com/zeyi2 updated 
https://github.com/llvm/llvm-project/pull/195609

>From 4ca17bf32ba0aca05e9775baa5d8ec5273731974 Mon Sep 17 00:00:00 2001
From: Zeyi Xu <[email protected]>
Date: Mon, 4 May 2026 16:21:32 +0800
Subject: [PATCH 1/3] [clang-tidy] Reject malformed -std spellings. NFC.

---
 clang-tools-extra/test/clang-tidy/check_clang_tidy.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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..f932b77ecaba3 100755
--- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -460,11 +460,14 @@ 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 not or_later:
         return [split_std]
 
+    if suffix:
+        return [std]
+
     for standard_list in (CPP_STANDARDS, C_STANDARDS):
         item = next(
             (

>From 771bb947142d20b26ecdf2b7dad7a4250c6dc7fb Mon Sep 17 00:00:00 2001
From: Zeyi Xu <[email protected]>
Date: Mon, 4 May 2026 16:44:42 +0800
Subject: [PATCH 2/3] fixup

---
 .../test/clang-tidy/check_clang_tidy.py       | 41 ++++++++++---------
 1 file changed, 22 insertions(+), 19 deletions(-)

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 f932b77ecaba3..557d637e3d44a 100755
--- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -462,25 +462,28 @@ def run(self) -> None:
 def expand_std(std: str) -> List[str]:
     split_std, or_later, suffix = std.partition("-or-later")
 
-    if not or_later:
-        return [split_std]
-
-    if suffix:
-        return [std]
-
-    for standard_list in (CPP_STANDARDS, C_STANDARDS):
-        item = next(
-            (
-                i
-                for i, v in enumerate(standard_list)
-                if (split_std in v if isinstance(v, (list, tuple)) else 
split_std == v)
-            ),
-            None,
-        )
-        if item is not None:
-            return [split_std] + [
-                x if isinstance(x, str) else x[0] for x in standard_list[item 
+ 1 :]
-            ]
+    if or_later:
+        if suffix:
+            # Keep malformed -or-later spellings unchanged so clang diagnoses 
them.
+            return [std]
+
+        for standard_list in (CPP_STANDARDS, C_STANDARDS):
+            item = next(
+                (
+                    i
+                    for i, v in enumerate(standard_list)
+                    if (
+                        split_std in v
+                        if isinstance(v, (list, tuple))
+                        else split_std == v
+                    )
+                ),
+                None,
+            )
+            if item is not None:
+                return [split_std] + [
+                    x if isinstance(x, str) else x[0] for x in 
standard_list[item + 1 :]
+                ]
     return [std]
 
 

>From 172092928016a58164d183fc99a02a190a27ae25 Mon Sep 17 00:00:00 2001
From: Zeyi Xu <[email protected]>
Date: Thu, 7 May 2026 13:35:48 +0800
Subject: [PATCH 3/3] fixup fixup fixup

---
 .../test/clang-tidy/check_clang_tidy.py       | 42 +++++++++----------
 1 file changed, 20 insertions(+), 22 deletions(-)

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 557d637e3d44a..7bd9647a66e89 100755
--- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -462,28 +462,26 @@ def run(self) -> None:
 def expand_std(std: str) -> List[str]:
     split_std, or_later, suffix = std.partition("-or-later")
 
-    if or_later:
-        if suffix:
-            # Keep malformed -or-later spellings unchanged so clang diagnoses 
them.
-            return [std]
-
-        for standard_list in (CPP_STANDARDS, C_STANDARDS):
-            item = next(
-                (
-                    i
-                    for i, v in enumerate(standard_list)
-                    if (
-                        split_std in v
-                        if isinstance(v, (list, tuple))
-                        else split_std == v
-                    )
-                ),
-                None,
-            )
-            if item is not None:
-                return [split_std] + [
-                    x if isinstance(x, str) else x[0] for x in 
standard_list[item + 1 :]
-                ]
+    if or_later and suffix:
+        # Keep malformed -or-later spellings unchanged so clang diagnoses them.
+        return [std]
+
+    if not or_later:
+        return [split_std]
+
+    for standard_list in (CPP_STANDARDS, C_STANDARDS):
+        item = next(
+            (
+                i
+                for i, v in enumerate(standard_list)
+                if (split_std in v if isinstance(v, (list, tuple)) else 
split_std == v)
+            ),
+            None,
+        )
+        if item is not None:
+            return [split_std] + [
+                x if isinstance(x, str) else x[0] for x in standard_list[item 
+ 1 :]
+            ]
     return [std]
 
 

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

Reply via email to