https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/107850
>From 36fff2ffdb29d8510c31464f6f6aad97721607c9 Mon Sep 17 00:00:00 2001 From: Julian Schmidt <git.julian.schm...@gmail.com> Date: Mon, 9 Sep 2024 14:03:12 +0200 Subject: [PATCH 1/2] [clang-tidy] remove type annotations that require python3.9 in add_new_check.py Subscripting `Tuple`: `Tuple[str, str]` is not supported until python 3.9. Tested with python 3.8.19, 3.9.19 and 3.12.4. Fixes #107846 --- clang-tools-extra/clang-tidy/add_new_check.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py index d384dbae28abbc..7230b3b17b2b79 100755 --- a/clang-tools-extra/clang-tidy/add_new_check.py +++ b/clang-tools-extra/clang-tidy/add_new_check.py @@ -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): 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: @@ -526,7 +526,7 @@ def process_doc(doc_file: Tuple[str, str]) -> Tuple[str, Optional[re.Match[str]] # Is it a redirect? return check_name, match - def format_link(doc_file: Tuple[str, str]) -> str: + def format_link(doc_file) -> str: check_name, match = process_doc(doc_file) if not match and check_name and not check_name.startswith("clang-analyzer-"): return " :doc:`%(check_name)s <%(module)s/%(check)s>`,%(autofix)s\n" % { @@ -538,7 +538,7 @@ def format_link(doc_file: Tuple[str, str]) -> str: else: return "" - def format_link_alias(doc_file: Tuple[str, str]) -> str: + def format_link_alias(doc_file) -> str: check_name, match = process_doc(doc_file) if (match or (check_name.startswith("clang-analyzer-"))) and check_name: module = doc_file[0] >From fb0a4421fce91f3e4ef8eecb1197a1ad89f0cb8b Mon Sep 17 00:00:00 2001 From: Julian Schmidt <git.julian.schm...@gmail.com> Date: Mon, 9 Sep 2024 15:34:45 +0200 Subject: [PATCH 2/2] removed wrong type subscript --- clang-tools-extra/clang-tidy/add_new_check.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py index 7230b3b17b2b79..d72a1d1121123f 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, Any # 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): + def process_doc(doc_file: Tuple[str, str]) -> Tuple[str, Optional[Any]]: 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: @@ -526,7 +526,7 @@ def process_doc(doc_file): # Is it a redirect? return check_name, match - def format_link(doc_file) -> str: + def format_link(doc_file: Tuple[str, str]) -> str: check_name, match = process_doc(doc_file) if not match and check_name and not check_name.startswith("clang-analyzer-"): return " :doc:`%(check_name)s <%(module)s/%(check)s>`,%(autofix)s\n" % { @@ -538,7 +538,7 @@ def format_link(doc_file) -> str: else: return "" - def format_link_alias(doc_file) -> str: + def format_link_alias(doc_file: Tuple[str, str]) -> str: check_name, match = process_doc(doc_file) if (match or (check_name.startswith("clang-analyzer-"))) and check_name: module = doc_file[0] _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits