[clang-tools-extra] [clang-tidy] Reject malformed -std spellings. NFC. (PR #195609)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 01:21:49 PDT 2026


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

None

>From 4ca17bf32ba0aca05e9775baa5d8ec5273731974 Mon Sep 17 00:00:00 2001
From: Zeyi Xu <mitchell.xu2 at gmail.com>
Date: Mon, 4 May 2026 16:21:32 +0800
Subject: [PATCH] [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(
             (



More information about the cfe-commits mailing list