[clang-tools-extra] 39751e7 - [clang-tidy][NFC] fix add_new_check python3.8 incompatibility (#107871)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 11 18:51:41 PDT 2024


Author: Congcong Cai
Date: 2024-09-12T09:51:38+08:00
New Revision: 39751e7ff998266bdefeaaf3b3bf3cdba26b0322

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

LOG: [clang-tidy][NFC] fix add_new_check python3.8 incompatibility (#107871)

Fixes: #107846

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/add_new_check.py

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py
index d384dbae28abbc..e366f100535357 100755
--- a/clang-tools-extra/clang-tidy/add_new_check.py
+++ b/clang-tools-extra/clang-tidy/add_new_check.py
@@ -17,7 +17,7 @@
 import textwrap
 
 # FIXME Python 3.9: Replace typing.Tuple with builtins.tuple.
-from typing import Optional, Tuple
+from typing import Optional, Tuple, Match
 
 
 # Adapts the module's CMakelist file. Returns 'True' if it could add a new
@@ -511,7 +511,7 @@ def has_auto_fix(check_name: str) -> str:
 
         return ""
 
-    def process_doc(doc_file: Tuple[str, str]) -> Tuple[str, Optional[re.Match[str]]]:
+    def process_doc(doc_file: Tuple[str, str]) -> Tuple[str, Optional[Match[str]]]:
         check_name = doc_file[0] + "-" + doc_file[1].replace(".rst", "")
 
         with io.open(os.path.join(docs_dir, *doc_file), "r", encoding="utf8") as doc:


        


More information about the cfe-commits mailing list