[llvm] [clang] Fix python escapes (PR #71170)
https://github.com/urnathan closed https://github.com/llvm/llvm-project/pull/71170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] Fix python escapes (PR #71170)
zufuliu wrote: Duplicate of #72538. https://github.com/llvm/llvm-project/pull/71170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] Fix python escapes (PR #71170)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Nathan Sidwell (urnathan) Changes With Fedora 39, I encountered 2 new python warnings: /home/nathan/gh/llvm/push/strict-aliasing/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py:28: SyntaxWarning: invalid escape sequence '\*' self.implementationContent += """ /home/nathan/gh/llvm/push/strict-aliasing/llvm/test/lit.cfg.py:274: SyntaxWarning: invalid escape sequence '\d' match = re.search("release (\d+)\.(\d+)", ptxas_out) Use raw strings here. I guess python got pickier or something? --- Full diff: https://github.com/llvm/llvm-project/pull/71170.diff 2 Files Affected: - (modified) clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py (+1-1) - (modified) llvm/test/lit.cfg.py (+1-1) ``diff diff --git a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py index dafb332961ede86..7671f9691c09610 100755 --- a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py +++ b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py @@ -25,7 +25,7 @@ def __init__(self, templateClasses): def GeneratePrologue(self): -self.implementationContent += """ +self.implementationContent += r""" /*===- Generated file ---*- C++ -*-===*\ |* *| |* Introspection of available AST node SourceLocations *| diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index ab245b71cdd16a5..5f4cff424f073b8 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -271,7 +271,7 @@ def ptxas_version(ptxas): ptxas_cmd = subprocess.Popen([ptxas, "--version"], stdout=subprocess.PIPE) ptxas_out = ptxas_cmd.stdout.read().decode("ascii") ptxas_cmd.wait() -match = re.search("release (\d+)\.(\d+)", ptxas_out) +match = re.search(r"release (\d+)\.(\d+)", ptxas_out) if match: return (int(match.group(1)), int(match.group(2))) print("couldn't determine ptxas version") `` https://github.com/llvm/llvm-project/pull/71170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] Fix python escapes (PR #71170)
https://github.com/urnathan ready_for_review https://github.com/llvm/llvm-project/pull/71170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] Fix python escapes (PR #71170)
https://github.com/urnathan edited https://github.com/llvm/llvm-project/pull/71170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] Fix python escapes (PR #71170)
https://github.com/urnathan updated https://github.com/llvm/llvm-project/pull/71170 >From 9b5cb1ac8d4b9a2aaa4c06e41620e38b6c3cae8c Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 2 Nov 2023 18:14:05 -0400 Subject: [PATCH 1/3] Fix python escapes With Fedora 39, I encountered 2 new python warnings: /home/nathan/gh/llvm/push/strict-aliasing/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py:28: SyntaxWarning: invalid escape sequence '\*' self.implementationContent += """ /home/nathan/gh/llvm/push/strict-aliasing/llvm/test/lit.cfg.py:274: SyntaxWarning: invalid escape sequence '\d' match = re.search("release (\d+)\.(\d+)", ptxas_out) Use raw strings here. I guess python got pickier or something? May as well fix the blank line caused by """NEWLINE ... """ --- clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py | 4 ++-- llvm/test/lit.cfg.py| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py index dafb332961ede86..54cfd0741f9d122 100755 --- a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py +++ b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py @@ -25,7 +25,7 @@ def __init__(self, templateClasses): def GeneratePrologue(self): -self.implementationContent += """ +self.implementationContent += R""" /*===- Generated file ---*- C++ -*-===*\ |* *| |* Introspection of available AST node SourceLocations *| @@ -58,7 +58,7 @@ def GeneratePrologue(self): private: std::vector }; -""" +"""[1:] def GenerateBaseGetLocationsDeclaration(self, CladeName): InstanceDecoration = "*" diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index ab245b71cdd16a5..cf050bbfe3b1413 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -271,7 +271,7 @@ def ptxas_version(ptxas): ptxas_cmd = subprocess.Popen([ptxas, "--version"], stdout=subprocess.PIPE) ptxas_out = ptxas_cmd.stdout.read().decode("ascii") ptxas_cmd.wait() -match = re.search("release (\d+)\.(\d+)", ptxas_out) +match = re.search(R"release (\d+)\.(\d+)", ptxas_out) if match: return (int(match.group(1)), int(match.group(2))) print("couldn't determine ptxas version") >From 0cf6eb5b293752525cace1dee1ba26e143386809 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 3 Nov 2023 07:44:11 -0400 Subject: [PATCH 2/3] Lower case raw string --- clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py | 2 +- llvm/test/lit.cfg.py| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py index 54cfd0741f9d122..a6843f70adedae9 100755 --- a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py +++ b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py @@ -25,7 +25,7 @@ def __init__(self, templateClasses): def GeneratePrologue(self): -self.implementationContent += R""" +self.implementationContent += r""" /*===- Generated file ---*- C++ -*-===*\ |* *| |* Introspection of available AST node SourceLocations *| diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index cf050bbfe3b1413..5f4cff424f073b8 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -271,7 +271,7 @@ def ptxas_version(ptxas): ptxas_cmd = subprocess.Popen([ptxas, "--version"], stdout=subprocess.PIPE) ptxas_out = ptxas_cmd.stdout.read().decode("ascii") ptxas_cmd.wait() -match = re.search(R"release (\d+)\.(\d+)", ptxas_out) +match = re.search(r"release (\d+)\.(\d+)", ptxas_out) if match: return (int(match.group(1)), int(match.group(2))) print("couldn't determine ptxas version") >From c483141c81052828a1a3793377b0bffdb2300a65 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 3 Nov 2023 08:18:33 -0400 Subject: [PATCH 3/3] lose [1:] --- clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py index a6843f70adedae9..7671f9691c09610 100755 --- a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py +++ b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py @@ -58,7 +58,7 @@ def GeneratePrologue(self): private: std::vector }; -"""[1:] +""" def GenerateBaseGetLocationsDeclaration(self, CladeName): InstanceDecoration = "*" ___ cfe-commits mailing list cfe-commits@lists.llvm.org
[llvm] [clang] Fix python escapes (PR #71170)
https://github.com/urnathan updated https://github.com/llvm/llvm-project/pull/71170 >From 9b5cb1ac8d4b9a2aaa4c06e41620e38b6c3cae8c Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 2 Nov 2023 18:14:05 -0400 Subject: [PATCH 1/2] Fix python escapes With Fedora 39, I encountered 2 new python warnings: /home/nathan/gh/llvm/push/strict-aliasing/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py:28: SyntaxWarning: invalid escape sequence '\*' self.implementationContent += """ /home/nathan/gh/llvm/push/strict-aliasing/llvm/test/lit.cfg.py:274: SyntaxWarning: invalid escape sequence '\d' match = re.search("release (\d+)\.(\d+)", ptxas_out) Use raw strings here. I guess python got pickier or something? May as well fix the blank line caused by """NEWLINE ... """ --- clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py | 4 ++-- llvm/test/lit.cfg.py| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py index dafb332961ede86..54cfd0741f9d122 100755 --- a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py +++ b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py @@ -25,7 +25,7 @@ def __init__(self, templateClasses): def GeneratePrologue(self): -self.implementationContent += """ +self.implementationContent += R""" /*===- Generated file ---*- C++ -*-===*\ |* *| |* Introspection of available AST node SourceLocations *| @@ -58,7 +58,7 @@ def GeneratePrologue(self): private: std::vector }; -""" +"""[1:] def GenerateBaseGetLocationsDeclaration(self, CladeName): InstanceDecoration = "*" diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index ab245b71cdd16a5..cf050bbfe3b1413 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -271,7 +271,7 @@ def ptxas_version(ptxas): ptxas_cmd = subprocess.Popen([ptxas, "--version"], stdout=subprocess.PIPE) ptxas_out = ptxas_cmd.stdout.read().decode("ascii") ptxas_cmd.wait() -match = re.search("release (\d+)\.(\d+)", ptxas_out) +match = re.search(R"release (\d+)\.(\d+)", ptxas_out) if match: return (int(match.group(1)), int(match.group(2))) print("couldn't determine ptxas version") >From 0cf6eb5b293752525cace1dee1ba26e143386809 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 3 Nov 2023 07:44:11 -0400 Subject: [PATCH 2/2] Lower case raw string --- clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py | 2 +- llvm/test/lit.cfg.py| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py index 54cfd0741f9d122..a6843f70adedae9 100755 --- a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py +++ b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py @@ -25,7 +25,7 @@ def __init__(self, templateClasses): def GeneratePrologue(self): -self.implementationContent += R""" +self.implementationContent += r""" /*===- Generated file ---*- C++ -*-===*\ |* *| |* Introspection of available AST node SourceLocations *| diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index cf050bbfe3b1413..5f4cff424f073b8 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -271,7 +271,7 @@ def ptxas_version(ptxas): ptxas_cmd = subprocess.Popen([ptxas, "--version"], stdout=subprocess.PIPE) ptxas_out = ptxas_cmd.stdout.read().decode("ascii") ptxas_cmd.wait() -match = re.search(R"release (\d+)\.(\d+)", ptxas_out) +match = re.search(r"release (\d+)\.(\d+)", ptxas_out) if match: return (int(match.group(1)), int(match.group(2))) print("couldn't determine ptxas version") ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] Fix python escapes (PR #71170)
https://github.com/urnathan created https://github.com/llvm/llvm-project/pull/71170 With Fedora 39, I encountered 2 new python warnings: /home/nathan/gh/llvm/push/strict-aliasing/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py:28: SyntaxWarning: invalid escape sequence '\*' self.implementationContent += """ /home/nathan/gh/llvm/push/strict-aliasing/llvm/test/lit.cfg.py:274: SyntaxWarning: invalid escape sequence '\d' match = re.search("release (\d+)\.(\d+)", ptxas_out) Use raw strings here. I guess python got pickier or something? While there, might as well fix the blank line caused by """NEWLINE ... """ by dropping its first char. >From 9b5cb1ac8d4b9a2aaa4c06e41620e38b6c3cae8c Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 2 Nov 2023 18:14:05 -0400 Subject: [PATCH] Fix python escapes With Fedora 39, I encountered 2 new python warnings: /home/nathan/gh/llvm/push/strict-aliasing/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py:28: SyntaxWarning: invalid escape sequence '\*' self.implementationContent += """ /home/nathan/gh/llvm/push/strict-aliasing/llvm/test/lit.cfg.py:274: SyntaxWarning: invalid escape sequence '\d' match = re.search("release (\d+)\.(\d+)", ptxas_out) Use raw strings here. I guess python got pickier or something? May as well fix the blank line caused by """NEWLINE ... """ --- clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py | 4 ++-- llvm/test/lit.cfg.py| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py index dafb332961ede86..54cfd0741f9d122 100755 --- a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py +++ b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py @@ -25,7 +25,7 @@ def __init__(self, templateClasses): def GeneratePrologue(self): -self.implementationContent += """ +self.implementationContent += R""" /*===- Generated file ---*- C++ -*-===*\ |* *| |* Introspection of available AST node SourceLocations *| @@ -58,7 +58,7 @@ def GeneratePrologue(self): private: std::vector }; -""" +"""[1:] def GenerateBaseGetLocationsDeclaration(self, CladeName): InstanceDecoration = "*" diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index ab245b71cdd16a5..cf050bbfe3b1413 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -271,7 +271,7 @@ def ptxas_version(ptxas): ptxas_cmd = subprocess.Popen([ptxas, "--version"], stdout=subprocess.PIPE) ptxas_out = ptxas_cmd.stdout.read().decode("ascii") ptxas_cmd.wait() -match = re.search("release (\d+)\.(\d+)", ptxas_out) +match = re.search(R"release (\d+)\.(\d+)", ptxas_out) if match: return (int(match.group(1)), int(match.group(2))) print("couldn't determine ptxas version") ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits