[clang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [openmp] [polly] fix(python): fix comparison to None (PR #91857)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/91857 >From 8379b042ef389e7c032e1bc3b32957bd386e2411 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH 1/2] fix(python): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- .../clang-tidy/checks/gen-static-analyzer-docs.py| 2 +- clang/docs/DebuggingCoroutines.rst | 8 clang/tools/include-mapping/gen_std.py | 2 +- clang/utils/check_cfc/obj_diff.py| 2 +- clang/utils/module-deps-to-rsp.py| 2 +- compiler-rt/test/asan/lit.cfg.py | 2 +- compiler-rt/test/builtins/Unit/lit.cfg.py| 2 +- compiler-rt/test/ctx_profile/lit.cfg.py | 2 +- compiler-rt/test/lsan/lit.common.cfg.py | 2 +- compiler-rt/test/memprof/lit.cfg.py | 2 +- compiler-rt/test/profile/lit.cfg.py | 2 +- .../android_commands/android_compile.py | 2 +- .../sanitizer_common/ios_commands/iossim_compile.py | 2 +- compiler-rt/test/ubsan/lit.common.cfg.py | 2 +- compiler-rt/test/ubsan_minimal/lit.common.cfg.py | 2 +- .../dexter/dex/command/ParseCommand.py | 2 +- .../DebuggerControllers/ConditionalController.py | 4 ++-- .../DebuggerControllers/ControllerHelpers.py | 2 +- .../debuginfo-tests/dexter/dex/debugger/Debuggers.py | 2 +- .../dexter/dex/debugger/visualstudio/VisualStudio.py | 2 +- .../debuginfo-tests/dexter/dex/tools/test/Tool.py| 2 +- cross-project-tests/lit.cfg.py | 2 +- lldb/docs/use/python.rst | 4 ++-- .../python/armv7_cortex_m_target_defintion.py| 2 +- lldb/packages/Python/lldbsuite/test/dotest.py| 2 +- lldb/packages/Python/lldbsuite/test/lldbtest.py | 6 +++--- lldb/packages/Python/lldbsuite/test/lldbutil.py | 6 +++--- .../lldbsuite/test/tools/intelpt/intelpt_testcase.py | 2 +- .../address_breakpoints/TestBadAddressBreakpoints.py | 2 +- .../step_scripted/TestStepScripted.py| 2 +- .../TestStopOnSharedlibraryEvents.py | 2 +- lldb/test/API/lua_api/TestLuaAPI.py | 2 +- .../thread_suspend/TestInternalThreadSuspension.py | 2 +- lldb/test/API/python_api/event/TestEvents.py | 2 +- .../process/read-mem-cstring/TestReadMemCString.py | 2 +- lldb/test/API/python_api/type/TestTypeList.py| 2 +- .../API/python_api/was_interrupted/interruptible.py | 2 +- lldb/test/Shell/lit.cfg.py | 2 +- llvm/utils/indirect_calls.py | 2 +- llvm/utils/lit/lit/TestRunner.py | 2 +- llvm/utils/lit/lit/util.py | 2 +- llvm/utils/schedcover.py | 2 +- llvm/utils/shuffle_select_fuzz_tester.py | 12 ++-- mlir/test/python/ir/affine_expr.py | 2 +- mlir/test/python/ir/attributes.py| 8 mlir/test/python/ir/builtin_types.py | 8 openmp/libompd/gdb-plugin/ompd/ompd_callbacks.py | 2 +- polly/lib/External/isl/libisl-gdb.py | 4 ++-- polly/lib/External/isl/python/isl.py.top | 4 ++-- polly/utils/pyscop/isl.py| 8 50 files changed, 75 insertions(+), 75 deletions(-) diff --git a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py index 6545a3906fa50..53ecb60dec539 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py +++ b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py @@ -47,7 +47,7 @@ def get_checkers(checkers_td, checkers_rst): parent_package_ = package["ParentPackage"] hidden = (checker["Hidden"] != 0) or (package["Hidden"] != 0) -while parent_package_ != None: +while parent_package_ is not None: parent_package = table_entries[parent_package_["def"]] checker_package_prefix = ( parent_package["PackageName"] + "." + checker_package_prefix diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 53bdd08fdbc02..7f464c1f4f28c 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -513,7 +513,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.coro_frame = coro_frame self.resume_func = dereference(self.coro_frame.resume_addr) self.resume_func_block = gdb.block_for_pc(self.resume_func) - if self.resume_func_
[clang-tools-extra] fix(clang-tools-extra/**.py): fix comparison to None (PR #94013)
https://github.com/e-kwsm created https://github.com/llvm/llvm-project/pull/94013 from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or is not, > never the equality operators. >From 0f57e398e77f3870f0367fffac0e440c2f4f1cbb Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(clang-tools-extra/**.py): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- .../clang-tidy/readability/IdentifierNamingCheck.cpp| 2 +- .../docs/clang-tidy/checks/gen-static-analyzer-docs.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp index 828f13805a698..1b1857124eb0f 100644 --- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -1071,7 +1071,7 @@ bool IdentifierNamingCheck::isParamInMainLikeFunction( if (!IsIntType(FDecl->parameters()[0]->getType())) return false; MainType Type = IsCharPtrPtr(FDecl->parameters()[1]->getType()); - if (Type == None) + if (Type is None) return false; if (FDecl->getNumParams() == 3 && IsCharPtrPtr(FDecl->parameters()[2]->getType()) != Type) diff --git a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py index 6545a3906fa50..53ecb60dec539 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py +++ b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py @@ -47,7 +47,7 @@ def get_checkers(checkers_td, checkers_rst): parent_package_ = package["ParentPackage"] hidden = (checker["Hidden"] != 0) or (package["Hidden"] != 0) -while parent_package_ != None: +while parent_package_ is not None: parent_package = table_entries[parent_package_["def"]] checker_package_prefix = ( parent_package["PackageName"] + "." + checker_package_prefix ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix comparison to None (PR #94014)
https://github.com/e-kwsm created https://github.com/llvm/llvm-project/pull/94014 from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or is not, > never the equality operators. >From c37043d186214a1d112cb4a628a4fba586a728dd Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(clang/**.py): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- clang/docs/DebuggingCoroutines.rst | 8 clang/tools/include-mapping/gen_std.py | 2 +- clang/utils/check_cfc/obj_diff.py | 2 +- clang/utils/module-deps-to-rsp.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 53bdd08fdbc02..7f464c1f4f28c 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -513,7 +513,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.coro_frame = coro_frame self.resume_func = dereference(self.coro_frame.resume_addr) self.resume_func_block = gdb.block_for_pc(self.resume_func) - if self.resume_func_block == None: + if self.resume_func_block is None: raise Exception('Not stackless coroutine.') self.line_info = gdb.find_pc_line(self.resume_func) @@ -543,8 +543,8 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.function_name = f def __str__(self, shift = 2): - addr = "" if self.address() == None else '%#x' % self.address() + " in " - location = "" if self.filename() == None else " at " + self.filename() + ":" + str(self.line()) + addr = "" if self.address() is None else '%#x' % self.address() + " in " + location = "" if self.filename() is None else " at " + self.filename() + ":" + str(self.line()) return addr + self.function() + " " + str([str(args) for args in self.frame_args()]) + location class CoroutineFilter: @@ -598,7 +598,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: addr = int(argv[0], 16) block = gdb.block_for_pc(long(cast_addr2long_pointer(addr).dereference())) - if block == None: + if block is None: print "block " + str(addr) + " is none." return diff --git a/clang/tools/include-mapping/gen_std.py b/clang/tools/include-mapping/gen_std.py index fcd3bd0d843ea..f362227bc6aab 100755 --- a/clang/tools/include-mapping/gen_std.py +++ b/clang/tools/include-mapping/gen_std.py @@ -215,7 +215,7 @@ def GetCCompatibilitySymbols(symbol): # Introduce two more entries, both in the global namespace, one using the # C++-compat header and another using the C header. results = [] -if symbol.namespace != None: +if symbol.namespace is not None: # avoid printing duplicated entries, for C macros! results.append(cppreference_parser.Symbol(symbol.name, None, [header])) c_header = "<" + header[2:-1] + ".h>" # => diff --git a/clang/utils/check_cfc/obj_diff.py b/clang/utils/check_cfc/obj_diff.py index 99ed19e522be2..9d602593a4e1a 100755 --- a/clang/utils/check_cfc/obj_diff.py +++ b/clang/utils/check_cfc/obj_diff.py @@ -57,7 +57,7 @@ def first_diff(a, b, fromfile, tofile): first_diff_idx = idx break -if first_diff_idx == None: +if first_diff_idx is None: # No difference return None diff --git a/clang/utils/module-deps-to-rsp.py b/clang/utils/module-deps-to-rsp.py index 6c9f263a786ef..b57a44e5c8780 100755 --- a/clang/utils/module-deps-to-rsp.py +++ b/clang/utils/module-deps-to-rsp.py @@ -74,7 +74,7 @@ def main(): if args.module_name: cmd = findModule(args.module_name, full_deps)["command-line"] -elif args.tu_index != None: +elif args.tu_index is not None: tu = full_deps.translation_units[args.tu_index] cmd = tu["commands"][args.tu_cmd_index]["command-line"] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [openmp] [polly] fix(python): fix comparison to None (PR #91857)
e-kwsm wrote: broken into - #94012 - #94013 - #94014 - #94015 - #94016 - #94017 - #94018 - #94019 - #94020 - #94021 - #94022 https://github.com/llvm/llvm-project/pull/91857 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [openmp] [polly] fix(python): fix comparison to None (PR #91857)
https://github.com/e-kwsm closed https://github.com/llvm/llvm-project/pull/91857 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] fix(clang-tools-extra/**.py): fix invalid escape sequences (PR #94028)
https://github.com/e-kwsm created https://github.com/llvm/llvm-project/pull/94028 None >From 531f7b8de97d7684c7eaecd43428ca4050d0c7d5 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang-tools-extra/**.py): fix invalid escape sequences --- clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py | 4 ++-- .../docs/clang-tidy/checks/gen-static-analyzer-docs.py| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py index d96b3450fdbe8..b048460abf2fc 100755 --- a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py +++ b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py @@ -242,7 +242,7 @@ def main(): filename = None lines_by_file = {} for line in sys.stdin: -match = re.search('^\+\+\+\ "?(.*?/){%s}([^ \t\n"]*)' % args.p, line) +match = re.search('^\\+\\+\\+\\ "?(.*?/){%s}([^ \t\n"]*)' % args.p, line) if match: filename = match.group(2) if filename is None: @@ -255,7 +255,7 @@ def main(): if not re.match("^%s$" % args.iregex, filename, re.IGNORECASE): continue -match = re.search("^@@.*\+(\d+)(,(\d+))?", line) +match = re.search(r"^@@.*\+(\d+)(,(\d+))?", line) if match: start_line = int(match.group(1)) line_count = 1 diff --git a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py index 6545a3906fa50..c19a0d3de7f11 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py +++ b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py @@ -59,7 +59,7 @@ def get_checkers(checkers_td, checkers_rst): "clang-analyzer-" + checker_package_prefix + "." + checker_name ) anchor_url = re.sub( -"\.", "-", checker_package_prefix + "." + checker_name +r"\.", "-", checker_package_prefix + "." + checker_name ).lower() if not hidden and "alpha" not in full_package_name.lower(): ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm created https://github.com/llvm/llvm-project/pull/94029 None >From 38272898d77ffd64215fbdbdaa7041d2d5e6016b Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 10 +- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 705ff0d4d4098..d47111819a1e2 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -86,11 +86,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -101,9 +101,9 @@ def extract_result_types(comment): def strip_doxygen(comment): -"""Returns the given comment without \-escaped words.""" +r"""Returns the given comment without \-escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. @@ -236,7 +236,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse the various matcher definition macros. m = re.match( -""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( +r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0..43968f4b1b6e8 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [lldb] [llvm] [mlir] [polly] fix(python): fix invalid escape sequences (PR #91856)
https://github.com/e-kwsm closed https://github.com/llvm/llvm-project/pull/91856 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [lldb] [llvm] [mlir] [polly] fix(python): fix invalid escape sequences (PR #91856)
e-kwsm wrote: broken into - #94028 - #94029 - #94030 - #94031 - #94032 - #94033 - #94034 - #94035 - #94036 - #94037 https://github.com/llvm/llvm-project/pull/91856 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lldb] [llvm] [openmp] [polly] fix(python): fix comparison to True/False (PR #91858)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/91858 >From cdc6e7c4ee2238e82fb9bf1754962d0aff10422b Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sun, 12 May 2024 00:06:53 +0900 Subject: [PATCH 1/2] fix(python): fix comparison to True/False from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- clang/tools/scan-build/bin/set-xcode-analyzer | 2 +- clang/utils/check_cfc/check_cfc.py | 4 ++-- lldb/examples/python/crashlog.py| 2 +- lldb/examples/python/disasm-stress-test.py | 4 ++-- lldb/examples/summaries/cocoa/CFString.py | 6 +++--- lldb/examples/summaries/pysummary.py| 2 +- lldb/examples/synthetic/bitfield/example.py | 2 +- lldb/packages/Python/lldbsuite/test/lldbtest.py | 2 +- lldb/test/API/commands/command/script/welcome.py| 2 +- .../commands/expression/call-throws/TestCallThatThrows.py | 6 +++--- .../disassemble/aarch64-adrp-add/TestAArch64AdrpAdd.py | 2 +- .../gdb_remote_client/TestNoWatchpointSupportInfo.py| 2 +- lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py | 2 +- lldb/test/API/tools/lldb-server/TestLldbGdbServer.py| 2 +- llvm/utils/indirect_calls.py| 2 +- openmp/libompd/gdb-plugin/ompd/ompd.py | 2 +- openmp/tools/archer/tests/lit.cfg | 2 +- .../External/isl/imath/tests/gmp-compat-test/genpytest.py | 2 +- 18 files changed, 24 insertions(+), 24 deletions(-) diff --git a/clang/tools/scan-build/bin/set-xcode-analyzer b/clang/tools/scan-build/bin/set-xcode-analyzer index f8c3f775ef7de..8d797bee4ae3b 100755 --- a/clang/tools/scan-build/bin/set-xcode-analyzer +++ b/clang/tools/scan-build/bin/set-xcode-analyzer @@ -107,7 +107,7 @@ def main(): foundSpec = True ModifySpec(x, isBuiltinAnalyzer, path) - if foundSpec == False: + if foundSpec is False: print "(-) No compiler configuration file was found. Xcode's analyzer has not been updated." if __name__ == '__main__': diff --git a/clang/utils/check_cfc/check_cfc.py b/clang/utils/check_cfc/check_cfc.py index 27d732d91030c..d4ddcb5bbb6a3 100755 --- a/clang/utils/check_cfc/check_cfc.py +++ b/clang/utils/check_cfc/check_cfc.py @@ -156,7 +156,7 @@ def get_output_file(args): elif arg.startswith("-o"): # Specified conjoined with -o return arg[2:] -assert grabnext == False +assert grabnext is False return None @@ -182,7 +182,7 @@ def replace_output_file(args, new_name): if replaceidx is None: raise Exception replacement = new_name -if attached == True: +if attached is True: replacement = "-o" + new_name args[replaceidx] = replacement return args diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 641b2e64d53b1..62bd73643a46e 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -166,7 +166,7 @@ def dump_symbolicated(self, crash_log, options): this_thread_crashed = self.app_specific_backtrace if not this_thread_crashed: this_thread_crashed = self.did_crash() -if options.crashed_only and this_thread_crashed == False: +if options.crashed_only and this_thread_crashed is False: return print("%s" % self) diff --git a/lldb/examples/python/disasm-stress-test.py b/lldb/examples/python/disasm-stress-test.py index 2d3314ee8e8ff..8487b24fdcba7 100755 --- a/lldb/examples/python/disasm-stress-test.py +++ b/lldb/examples/python/disasm-stress-test.py @@ -95,13 +95,13 @@ def GetLLDBFrameworkPath(): debugger = lldb.SBDebugger.Create() -if debugger.IsValid() == False: +if debugger.IsValid() is False: print("Couldn't create an SBDebugger") sys.exit(-1) target = debugger.CreateTargetWithFileAndArch(None, arg_ns.arch) -if target.IsValid() == False: +if target.IsValid() is False: print("Couldn't create an SBTarget for architecture " + arg_ns.arch) sys.exit(-1) diff --git a/lldb/examples/summaries/cocoa/CFString.py b/lldb/examples/summaries/cocoa/CFString.py index 13c294ca34122..fdea2c48870cb 100644 --- a/lldb/examples/summaries/cocoa/CFString.py +++ b/lldb/examples/summaries/cocoa/CFString.py @@ -253,9 +253,9 @@ def get_child_at_index(self, index): elif ( self.inline and self.explicit -and self.unicode == False -and self.special == False -and self.mutable == False +and self.unicode is False +and self.special is False +and self.mutable is False
[clang] fix(clang/**.py): fix comparison to True/False (PR #94038)
https://github.com/e-kwsm created https://github.com/llvm/llvm-project/pull/94038 from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or is not, > never the equality operators. >From 33ef0fc3c3434283ca253c941a5bbb48ab146154 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sun, 12 May 2024 00:06:53 +0900 Subject: [PATCH] fix(clang/**.py): fix comparison to True/False from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- clang/tools/scan-build/bin/set-xcode-analyzer | 2 +- clang/utils/check_cfc/check_cfc.py| 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/tools/scan-build/bin/set-xcode-analyzer b/clang/tools/scan-build/bin/set-xcode-analyzer index f8c3f775ef7de..8e4a5794594a6 100755 --- a/clang/tools/scan-build/bin/set-xcode-analyzer +++ b/clang/tools/scan-build/bin/set-xcode-analyzer @@ -107,7 +107,7 @@ def main(): foundSpec = True ModifySpec(x, isBuiltinAnalyzer, path) - if foundSpec == False: + if not foundSpec: print "(-) No compiler configuration file was found. Xcode's analyzer has not been updated." if __name__ == '__main__': diff --git a/clang/utils/check_cfc/check_cfc.py b/clang/utils/check_cfc/check_cfc.py index 27d732d91030c..8d42ec532bbb7 100755 --- a/clang/utils/check_cfc/check_cfc.py +++ b/clang/utils/check_cfc/check_cfc.py @@ -156,7 +156,7 @@ def get_output_file(args): elif arg.startswith("-o"): # Specified conjoined with -o return arg[2:] -assert grabnext == False +assert not grabnext return None @@ -182,7 +182,7 @@ def replace_output_file(args, new_name): if replaceidx is None: raise Exception replacement = new_name -if attached == True: +if attached: replacement = "-o" + new_name args[replaceidx] = replacement return args ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lldb] [llvm] [openmp] [polly] fix(python): fix comparison to True/False (PR #91858)
https://github.com/e-kwsm closed https://github.com/llvm/llvm-project/pull/91858 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lldb] [llvm] [openmp] [polly] fix(python): fix comparison to True/False (PR #91858)
e-kwsm wrote: Broken into - #94038 - #94039 - #94040 - #94041 - #94042 https://github.com/llvm/llvm-project/pull/91858 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] fix(clang-tools-extra/**.py): fix comparison to None (PR #94013)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94013 >From 0697c7c7976eb3c01c0f51495560ce6000176434 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(clang-tools-extra/**.py): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- .../docs/clang-tidy/checks/gen-static-analyzer-docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py index 6545a3906fa50..53ecb60dec539 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py +++ b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py @@ -47,7 +47,7 @@ def get_checkers(checkers_td, checkers_rst): parent_package_ = package["ParentPackage"] hidden = (checker["Hidden"] != 0) or (package["Hidden"] != 0) -while parent_package_ != None: +while parent_package_ is not None: parent_package = table_entries[parent_package_["def"]] checker_package_prefix = ( parent_package["PackageName"] + "." + checker_package_prefix ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] fix(clang-tools-extra/**.py): fix comparison to None (PR #94013)
@@ -1071,7 +1071,7 @@ bool IdentifierNamingCheck::isParamInMainLikeFunction( if (!IsIntType(FDecl->parameters()[0]->getType())) return false; MainType Type = IsCharPtrPtr(FDecl->parameters()[1]->getType()); - if (Type == None) + if (Type is None) e-kwsm wrote: Thank you for your review. https://github.com/llvm/llvm-project/pull/94013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix comparison to None (PR #94014)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94014 >From cbc322d63ab460a1e13aa84b41c41c100fad13f9 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(clang/**.py): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- clang/docs/DebuggingCoroutines.rst | 8 clang/tools/include-mapping/gen_std.py | 2 +- clang/utils/check_cfc/obj_diff.py | 2 +- clang/utils/module-deps-to-rsp.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 53bdd08fdbc02..7f464c1f4f28c 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -513,7 +513,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.coro_frame = coro_frame self.resume_func = dereference(self.coro_frame.resume_addr) self.resume_func_block = gdb.block_for_pc(self.resume_func) - if self.resume_func_block == None: + if self.resume_func_block is None: raise Exception('Not stackless coroutine.') self.line_info = gdb.find_pc_line(self.resume_func) @@ -543,8 +543,8 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.function_name = f def __str__(self, shift = 2): - addr = "" if self.address() == None else '%#x' % self.address() + " in " - location = "" if self.filename() == None else " at " + self.filename() + ":" + str(self.line()) + addr = "" if self.address() is None else '%#x' % self.address() + " in " + location = "" if self.filename() is None else " at " + self.filename() + ":" + str(self.line()) return addr + self.function() + " " + str([str(args) for args in self.frame_args()]) + location class CoroutineFilter: @@ -598,7 +598,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: addr = int(argv[0], 16) block = gdb.block_for_pc(long(cast_addr2long_pointer(addr).dereference())) - if block == None: + if block is None: print "block " + str(addr) + " is none." return diff --git a/clang/tools/include-mapping/gen_std.py b/clang/tools/include-mapping/gen_std.py index fcd3bd0d843ea..f362227bc6aab 100755 --- a/clang/tools/include-mapping/gen_std.py +++ b/clang/tools/include-mapping/gen_std.py @@ -215,7 +215,7 @@ def GetCCompatibilitySymbols(symbol): # Introduce two more entries, both in the global namespace, one using the # C++-compat header and another using the C header. results = [] -if symbol.namespace != None: +if symbol.namespace is not None: # avoid printing duplicated entries, for C macros! results.append(cppreference_parser.Symbol(symbol.name, None, [header])) c_header = "<" + header[2:-1] + ".h>" # => diff --git a/clang/utils/check_cfc/obj_diff.py b/clang/utils/check_cfc/obj_diff.py index 99ed19e522be2..9d602593a4e1a 100755 --- a/clang/utils/check_cfc/obj_diff.py +++ b/clang/utils/check_cfc/obj_diff.py @@ -57,7 +57,7 @@ def first_diff(a, b, fromfile, tofile): first_diff_idx = idx break -if first_diff_idx == None: +if first_diff_idx is None: # No difference return None diff --git a/clang/utils/module-deps-to-rsp.py b/clang/utils/module-deps-to-rsp.py index 6c9f263a786ef..b57a44e5c8780 100755 --- a/clang/utils/module-deps-to-rsp.py +++ b/clang/utils/module-deps-to-rsp.py @@ -74,7 +74,7 @@ def main(): if args.module_name: cmd = findModule(args.module_name, full_deps)["command-line"] -elif args.tu_index != None: +elif args.tu_index is not None: tu = full_deps.translation_units[args.tu_index] cmd = tu["commands"][args.tu_cmd_index]["command-line"] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix comparison to None (PR #94014)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94014 >From 406492bea31d26735d1da1087665e5cb46c8c1ea Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(clang/**.py): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- clang/docs/DebuggingCoroutines.rst | 8 clang/tools/include-mapping/gen_std.py | 2 +- clang/utils/check_cfc/obj_diff.py | 2 +- clang/utils/module-deps-to-rsp.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 53bdd08fdbc02f..7f464c1f4f28ca 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -513,7 +513,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.coro_frame = coro_frame self.resume_func = dereference(self.coro_frame.resume_addr) self.resume_func_block = gdb.block_for_pc(self.resume_func) - if self.resume_func_block == None: + if self.resume_func_block is None: raise Exception('Not stackless coroutine.') self.line_info = gdb.find_pc_line(self.resume_func) @@ -543,8 +543,8 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.function_name = f def __str__(self, shift = 2): - addr = "" if self.address() == None else '%#x' % self.address() + " in " - location = "" if self.filename() == None else " at " + self.filename() + ":" + str(self.line()) + addr = "" if self.address() is None else '%#x' % self.address() + " in " + location = "" if self.filename() is None else " at " + self.filename() + ":" + str(self.line()) return addr + self.function() + " " + str([str(args) for args in self.frame_args()]) + location class CoroutineFilter: @@ -598,7 +598,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: addr = int(argv[0], 16) block = gdb.block_for_pc(long(cast_addr2long_pointer(addr).dereference())) - if block == None: + if block is None: print "block " + str(addr) + " is none." return diff --git a/clang/tools/include-mapping/gen_std.py b/clang/tools/include-mapping/gen_std.py index fcd3bd0d843ea1..f362227bc6aab9 100755 --- a/clang/tools/include-mapping/gen_std.py +++ b/clang/tools/include-mapping/gen_std.py @@ -215,7 +215,7 @@ def GetCCompatibilitySymbols(symbol): # Introduce two more entries, both in the global namespace, one using the # C++-compat header and another using the C header. results = [] -if symbol.namespace != None: +if symbol.namespace is not None: # avoid printing duplicated entries, for C macros! results.append(cppreference_parser.Symbol(symbol.name, None, [header])) c_header = "<" + header[2:-1] + ".h>" # => diff --git a/clang/utils/check_cfc/obj_diff.py b/clang/utils/check_cfc/obj_diff.py index 99ed19e522be20..9d602593a4e1a9 100755 --- a/clang/utils/check_cfc/obj_diff.py +++ b/clang/utils/check_cfc/obj_diff.py @@ -57,7 +57,7 @@ def first_diff(a, b, fromfile, tofile): first_diff_idx = idx break -if first_diff_idx == None: +if first_diff_idx is None: # No difference return None diff --git a/clang/utils/module-deps-to-rsp.py b/clang/utils/module-deps-to-rsp.py index 6c9f263a786efc..b57a44e5c87809 100755 --- a/clang/utils/module-deps-to-rsp.py +++ b/clang/utils/module-deps-to-rsp.py @@ -74,7 +74,7 @@ def main(): if args.module_name: cmd = findModule(args.module_name, full_deps)["command-line"] -elif args.tu_index != None: +elif args.tu_index is not None: tu = full_deps.translation_units[args.tu_index] cmd = tu["commands"][args.tu_cmd_index]["command-line"] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94029 >From 1358b29f145d83dc315f3209cf2e9f290cfb8e4c Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 10 +- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 705ff0d4d40985..d47111819a1e2d 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -86,11 +86,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -101,9 +101,9 @@ def extract_result_types(comment): def strip_doxygen(comment): -"""Returns the given comment without \-escaped words.""" +r"""Returns the given comment without \-escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. @@ -236,7 +236,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse the various matcher definition macros. m = re.match( -""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( +r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0c..43968f4b1b6e8d 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix comparison to None (PR #94014)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94014 >From 70a3af851a0928bff0244a9d6fe4cd7fa0466a42 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(clang/**.py): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- clang/docs/DebuggingCoroutines.rst | 8 clang/tools/include-mapping/gen_std.py | 2 +- clang/utils/check_cfc/obj_diff.py | 2 +- clang/utils/module-deps-to-rsp.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 53bdd08fdbc02f..7f464c1f4f28ca 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -513,7 +513,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.coro_frame = coro_frame self.resume_func = dereference(self.coro_frame.resume_addr) self.resume_func_block = gdb.block_for_pc(self.resume_func) - if self.resume_func_block == None: + if self.resume_func_block is None: raise Exception('Not stackless coroutine.') self.line_info = gdb.find_pc_line(self.resume_func) @@ -543,8 +543,8 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.function_name = f def __str__(self, shift = 2): - addr = "" if self.address() == None else '%#x' % self.address() + " in " - location = "" if self.filename() == None else " at " + self.filename() + ":" + str(self.line()) + addr = "" if self.address() is None else '%#x' % self.address() + " in " + location = "" if self.filename() is None else " at " + self.filename() + ":" + str(self.line()) return addr + self.function() + " " + str([str(args) for args in self.frame_args()]) + location class CoroutineFilter: @@ -598,7 +598,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: addr = int(argv[0], 16) block = gdb.block_for_pc(long(cast_addr2long_pointer(addr).dereference())) - if block == None: + if block is None: print "block " + str(addr) + " is none." return diff --git a/clang/tools/include-mapping/gen_std.py b/clang/tools/include-mapping/gen_std.py index fcd3bd0d843ea1..f362227bc6aab9 100755 --- a/clang/tools/include-mapping/gen_std.py +++ b/clang/tools/include-mapping/gen_std.py @@ -215,7 +215,7 @@ def GetCCompatibilitySymbols(symbol): # Introduce two more entries, both in the global namespace, one using the # C++-compat header and another using the C header. results = [] -if symbol.namespace != None: +if symbol.namespace is not None: # avoid printing duplicated entries, for C macros! results.append(cppreference_parser.Symbol(symbol.name, None, [header])) c_header = "<" + header[2:-1] + ".h>" # => diff --git a/clang/utils/check_cfc/obj_diff.py b/clang/utils/check_cfc/obj_diff.py index 99ed19e522be20..9d602593a4e1a9 100755 --- a/clang/utils/check_cfc/obj_diff.py +++ b/clang/utils/check_cfc/obj_diff.py @@ -57,7 +57,7 @@ def first_diff(a, b, fromfile, tofile): first_diff_idx = idx break -if first_diff_idx == None: +if first_diff_idx is None: # No difference return None diff --git a/clang/utils/module-deps-to-rsp.py b/clang/utils/module-deps-to-rsp.py index 6c9f263a786efc..b57a44e5c87809 100755 --- a/clang/utils/module-deps-to-rsp.py +++ b/clang/utils/module-deps-to-rsp.py @@ -74,7 +74,7 @@ def main(): if args.module_name: cmd = findModule(args.module_name, full_deps)["command-line"] -elif args.tu_index != None: +elif args.tu_index is not None: tu = full_deps.translation_units[args.tu_index] cmd = tu["commands"][args.tu_cmd_index]["command-line"] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94029 >From 3d9fa04f2b42030f27eb6e21a6e238c8a6a74b20 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 10 +- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 705ff0d4d40985..d47111819a1e2d 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -86,11 +86,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -101,9 +101,9 @@ def extract_result_types(comment): def strip_doxygen(comment): -"""Returns the given comment without \-escaped words.""" +r"""Returns the given comment without \-escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. @@ -236,7 +236,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse the various matcher definition macros. m = re.match( -""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( +r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0c..43968f4b1b6e8d 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [openmp] [polly] fix(python): fix comparison to None (PR #91857)
https://github.com/e-kwsm created https://github.com/llvm/llvm-project/pull/91857 None >From c450df191a6b96591d7c7a7454b6e15cb925520f Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(python): fix comparison to None --- .../clang-tidy/checks/gen-static-analyzer-docs.py| 2 +- clang/docs/DebuggingCoroutines.rst | 8 clang/tools/include-mapping/gen_std.py | 2 +- clang/utils/check_cfc/obj_diff.py| 2 +- clang/utils/module-deps-to-rsp.py| 2 +- compiler-rt/test/asan/lit.cfg.py | 2 +- compiler-rt/test/builtins/Unit/lit.cfg.py| 2 +- compiler-rt/test/ctx_profile/lit.cfg.py | 2 +- compiler-rt/test/lsan/lit.common.cfg.py | 2 +- compiler-rt/test/memprof/lit.cfg.py | 2 +- compiler-rt/test/profile/lit.cfg.py | 2 +- .../android_commands/android_compile.py | 2 +- .../sanitizer_common/ios_commands/iossim_compile.py | 2 +- compiler-rt/test/ubsan/lit.common.cfg.py | 2 +- compiler-rt/test/ubsan_minimal/lit.common.cfg.py | 2 +- .../dexter/dex/command/ParseCommand.py | 2 +- .../DebuggerControllers/ConditionalController.py | 4 ++-- .../DebuggerControllers/ControllerHelpers.py | 2 +- .../debuginfo-tests/dexter/dex/debugger/Debuggers.py | 2 +- .../dexter/dex/debugger/visualstudio/VisualStudio.py | 2 +- .../debuginfo-tests/dexter/dex/tools/test/Tool.py| 2 +- cross-project-tests/lit.cfg.py | 2 +- lldb/docs/use/python.rst | 4 ++-- .../python/armv7_cortex_m_target_defintion.py| 2 +- lldb/packages/Python/lldbsuite/test/dotest.py| 2 +- lldb/packages/Python/lldbsuite/test/lldbtest.py | 6 +++--- lldb/packages/Python/lldbsuite/test/lldbutil.py | 6 +++--- .../lldbsuite/test/tools/intelpt/intelpt_testcase.py | 2 +- .../address_breakpoints/TestBadAddressBreakpoints.py | 2 +- .../step_scripted/TestStepScripted.py| 2 +- .../TestStopOnSharedlibraryEvents.py | 2 +- lldb/test/API/lua_api/TestLuaAPI.py | 2 +- .../thread_suspend/TestInternalThreadSuspension.py | 2 +- lldb/test/API/python_api/event/TestEvents.py | 2 +- .../process/read-mem-cstring/TestReadMemCString.py | 2 +- lldb/test/API/python_api/type/TestTypeList.py| 2 +- .../API/python_api/was_interrupted/interruptible.py | 2 +- lldb/test/Shell/lit.cfg.py | 2 +- llvm/utils/indirect_calls.py | 2 +- llvm/utils/lit/lit/TestRunner.py | 2 +- llvm/utils/lit/lit/util.py | 2 +- llvm/utils/schedcover.py | 2 +- llvm/utils/shuffle_select_fuzz_tester.py | 12 ++-- mlir/test/python/ir/affine_expr.py | 2 +- mlir/test/python/ir/attributes.py| 8 mlir/test/python/ir/builtin_types.py | 8 openmp/libompd/gdb-plugin/ompd/ompd_callbacks.py | 2 +- polly/lib/External/isl/libisl-gdb.py | 4 ++-- polly/lib/External/isl/python/isl.py.top | 4 ++-- polly/utils/pyscop/isl.py| 8 50 files changed, 75 insertions(+), 75 deletions(-) diff --git a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py index 6545a3906fa50..53ecb60dec539 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py +++ b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py @@ -47,7 +47,7 @@ def get_checkers(checkers_td, checkers_rst): parent_package_ = package["ParentPackage"] hidden = (checker["Hidden"] != 0) or (package["Hidden"] != 0) -while parent_package_ != None: +while parent_package_ is not None: parent_package = table_entries[parent_package_["def"]] checker_package_prefix = ( parent_package["PackageName"] + "." + checker_package_prefix diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 53bdd08fdbc02..7f464c1f4f28c 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -513,7 +513,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.coro_frame = coro_frame self.resume_func = dereference(self.coro_frame.resume_addr) self.resume_func_block = gdb.block_for_pc(self.resume_func) - if self.resume_func_block == None: + if self.resume_func_block is None: raise Exception('Not stackless coroutine.') self.line_info = gdb.find_pc_line(self.resume_func)
[clang] [lldb] [llvm] [openmp] [polly] fix(python): fix comparison to True/False (PR #91858)
https://github.com/e-kwsm created https://github.com/llvm/llvm-project/pull/91858 None >From 1e31186c01024c63fa4c0bd378fec7131ce84d56 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sun, 12 May 2024 00:06:53 +0900 Subject: [PATCH] fix(python): fix comparison to True/False --- clang/tools/scan-build/bin/set-xcode-analyzer | 2 +- clang/utils/check_cfc/check_cfc.py | 4 ++-- lldb/examples/python/crashlog.py| 2 +- lldb/examples/python/disasm-stress-test.py | 4 ++-- lldb/examples/summaries/cocoa/CFString.py | 6 +++--- lldb/examples/summaries/pysummary.py| 2 +- lldb/examples/synthetic/bitfield/example.py | 2 +- lldb/packages/Python/lldbsuite/test/lldbtest.py | 2 +- lldb/test/API/commands/command/script/welcome.py| 2 +- .../commands/expression/call-throws/TestCallThatThrows.py | 6 +++--- .../disassemble/aarch64-adrp-add/TestAArch64AdrpAdd.py | 2 +- .../gdb_remote_client/TestNoWatchpointSupportInfo.py| 2 +- lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py | 2 +- lldb/test/API/tools/lldb-server/TestLldbGdbServer.py| 2 +- llvm/utils/indirect_calls.py| 2 +- openmp/libompd/gdb-plugin/ompd/ompd.py | 2 +- openmp/tools/archer/tests/lit.cfg | 2 +- .../External/isl/imath/tests/gmp-compat-test/genpytest.py | 2 +- 18 files changed, 24 insertions(+), 24 deletions(-) diff --git a/clang/tools/scan-build/bin/set-xcode-analyzer b/clang/tools/scan-build/bin/set-xcode-analyzer index f8c3f775ef7de..8d797bee4ae3b 100755 --- a/clang/tools/scan-build/bin/set-xcode-analyzer +++ b/clang/tools/scan-build/bin/set-xcode-analyzer @@ -107,7 +107,7 @@ def main(): foundSpec = True ModifySpec(x, isBuiltinAnalyzer, path) - if foundSpec == False: + if foundSpec is False: print "(-) No compiler configuration file was found. Xcode's analyzer has not been updated." if __name__ == '__main__': diff --git a/clang/utils/check_cfc/check_cfc.py b/clang/utils/check_cfc/check_cfc.py index 27d732d91030c..d4ddcb5bbb6a3 100755 --- a/clang/utils/check_cfc/check_cfc.py +++ b/clang/utils/check_cfc/check_cfc.py @@ -156,7 +156,7 @@ def get_output_file(args): elif arg.startswith("-o"): # Specified conjoined with -o return arg[2:] -assert grabnext == False +assert grabnext is False return None @@ -182,7 +182,7 @@ def replace_output_file(args, new_name): if replaceidx is None: raise Exception replacement = new_name -if attached == True: +if attached is True: replacement = "-o" + new_name args[replaceidx] = replacement return args diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 641b2e64d53b1..62bd73643a46e 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -166,7 +166,7 @@ def dump_symbolicated(self, crash_log, options): this_thread_crashed = self.app_specific_backtrace if not this_thread_crashed: this_thread_crashed = self.did_crash() -if options.crashed_only and this_thread_crashed == False: +if options.crashed_only and this_thread_crashed is False: return print("%s" % self) diff --git a/lldb/examples/python/disasm-stress-test.py b/lldb/examples/python/disasm-stress-test.py index 2d3314ee8e8ff..8487b24fdcba7 100755 --- a/lldb/examples/python/disasm-stress-test.py +++ b/lldb/examples/python/disasm-stress-test.py @@ -95,13 +95,13 @@ def GetLLDBFrameworkPath(): debugger = lldb.SBDebugger.Create() -if debugger.IsValid() == False: +if debugger.IsValid() is False: print("Couldn't create an SBDebugger") sys.exit(-1) target = debugger.CreateTargetWithFileAndArch(None, arg_ns.arch) -if target.IsValid() == False: +if target.IsValid() is False: print("Couldn't create an SBTarget for architecture " + arg_ns.arch) sys.exit(-1) diff --git a/lldb/examples/summaries/cocoa/CFString.py b/lldb/examples/summaries/cocoa/CFString.py index 13c294ca34122..fdea2c48870cb 100644 --- a/lldb/examples/summaries/cocoa/CFString.py +++ b/lldb/examples/summaries/cocoa/CFString.py @@ -253,9 +253,9 @@ def get_child_at_index(self, index): elif ( self.inline and self.explicit -and self.unicode == False -and self.special == False -and self.mutable == False +and self.unicode is False +and self.special is False +and self.mutable is False ): return self.handle_inline_explicit() elif self.unicode: diff --git a/lldb/examples/summaries/pysummary.py b/lldb/examples/summaries/pysummar
[clang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [openmp] [polly] fix(python): fix comparison to None (PR #91857)
e-kwsm wrote: >From [PEP8](https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with `is` or `is > not`, never the equality operators. [flake8](https://flake8.pycqa.org/en/latest/) is used here. https://github.com/llvm/llvm-project/pull/91857 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [lldb] [llvm] [mlir] [polly] fix(python): fix invalid escape sequences (PR #91856)
e-kwsm wrote: > Why do we need to make this change? The valid escape sequences in Python are listed [here](https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences): `\t`, `\n`, etc. Invalid ones fixed here seem to be used for regular expression, [re](https://docs.python.org/3/library/re.html), e.g. `\.` for literal dot, `\d` for a digit `[0-9]`. I use [flake8](https://flake8.pycqa.org/en/latest/) for check. > Did you use a script to generate this patch? No. We have choices to fix these: 1. escape backslashes: `"\s"` -> `"\\s"` 2. use raw string: `"\s"` -> `r"\s"` I thought 2 is simple but actually it does not work for e.g.: ```diff --- a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py +++ b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py @@ -242,7 +242,7 @@ def main(): filename = None lines_by_file = {} for line in sys.stdin: -match = re.search('^\+\+\+\ "?(.*?/){%s}([^ \t\n"]*)' % args.p, line) +match = re.search('^\\+\\+\\+\\ "?(.*?/){%s}([^ \t\n"]*)' % args.p, line) if match: filename = match.group(2) if filename is None: ``` Here `\t\n` is valid whereas `\+` is not. So I manually fixed them. https://github.com/llvm/llvm-project/pull/91856 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [openmp] [polly] fix(python): fix comparison to None (PR #91857)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/91857 >From 7cec823d9a87b90bf8d9ae5c975f4492076e0abb Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(python): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or is not, > never the equality operators. --- .../clang-tidy/checks/gen-static-analyzer-docs.py| 2 +- clang/docs/DebuggingCoroutines.rst | 8 clang/tools/include-mapping/gen_std.py | 2 +- clang/utils/check_cfc/obj_diff.py| 2 +- clang/utils/module-deps-to-rsp.py| 2 +- compiler-rt/test/asan/lit.cfg.py | 2 +- compiler-rt/test/builtins/Unit/lit.cfg.py| 2 +- compiler-rt/test/ctx_profile/lit.cfg.py | 2 +- compiler-rt/test/lsan/lit.common.cfg.py | 2 +- compiler-rt/test/memprof/lit.cfg.py | 2 +- compiler-rt/test/profile/lit.cfg.py | 2 +- .../android_commands/android_compile.py | 2 +- .../sanitizer_common/ios_commands/iossim_compile.py | 2 +- compiler-rt/test/ubsan/lit.common.cfg.py | 2 +- compiler-rt/test/ubsan_minimal/lit.common.cfg.py | 2 +- .../dexter/dex/command/ParseCommand.py | 2 +- .../DebuggerControllers/ConditionalController.py | 4 ++-- .../DebuggerControllers/ControllerHelpers.py | 2 +- .../debuginfo-tests/dexter/dex/debugger/Debuggers.py | 2 +- .../dexter/dex/debugger/visualstudio/VisualStudio.py | 2 +- .../debuginfo-tests/dexter/dex/tools/test/Tool.py| 2 +- cross-project-tests/lit.cfg.py | 2 +- lldb/docs/use/python.rst | 4 ++-- .../python/armv7_cortex_m_target_defintion.py| 2 +- lldb/packages/Python/lldbsuite/test/dotest.py| 2 +- lldb/packages/Python/lldbsuite/test/lldbtest.py | 6 +++--- lldb/packages/Python/lldbsuite/test/lldbutil.py | 6 +++--- .../lldbsuite/test/tools/intelpt/intelpt_testcase.py | 2 +- .../address_breakpoints/TestBadAddressBreakpoints.py | 2 +- .../step_scripted/TestStepScripted.py| 2 +- .../TestStopOnSharedlibraryEvents.py | 2 +- lldb/test/API/lua_api/TestLuaAPI.py | 2 +- .../thread_suspend/TestInternalThreadSuspension.py | 2 +- lldb/test/API/python_api/event/TestEvents.py | 2 +- .../process/read-mem-cstring/TestReadMemCString.py | 2 +- lldb/test/API/python_api/type/TestTypeList.py| 2 +- .../API/python_api/was_interrupted/interruptible.py | 2 +- lldb/test/Shell/lit.cfg.py | 2 +- llvm/utils/indirect_calls.py | 2 +- llvm/utils/lit/lit/TestRunner.py | 2 +- llvm/utils/lit/lit/util.py | 2 +- llvm/utils/schedcover.py | 2 +- llvm/utils/shuffle_select_fuzz_tester.py | 12 ++-- mlir/test/python/ir/affine_expr.py | 2 +- mlir/test/python/ir/attributes.py| 8 mlir/test/python/ir/builtin_types.py | 8 openmp/libompd/gdb-plugin/ompd/ompd_callbacks.py | 2 +- polly/lib/External/isl/libisl-gdb.py | 4 ++-- polly/lib/External/isl/python/isl.py.top | 4 ++-- polly/utils/pyscop/isl.py| 8 50 files changed, 75 insertions(+), 75 deletions(-) diff --git a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py index 6545a3906fa50..53ecb60dec539 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py +++ b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py @@ -47,7 +47,7 @@ def get_checkers(checkers_td, checkers_rst): parent_package_ = package["ParentPackage"] hidden = (checker["Hidden"] != 0) or (package["Hidden"] != 0) -while parent_package_ != None: +while parent_package_ is not None: parent_package = table_entries[parent_package_["def"]] checker_package_prefix = ( parent_package["PackageName"] + "." + checker_package_prefix diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 53bdd08fdbc02..7f464c1f4f28c 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -513,7 +513,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.coro_frame = coro_frame self.resume_func = dereference(self.coro_frame.resume_addr) self.resume_func_block = gdb.block_for_pc(self.resume_func) - if self.resume_func_blo
[clang] [lldb] [llvm] [openmp] [polly] fix(python): fix comparison to True/False (PR #91858)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/91858 >From 12e8ea6a0e104efbe130dd15d4d9051a7d86d50e Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sun, 12 May 2024 00:06:53 +0900 Subject: [PATCH] fix(python): fix comparison to True/False from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or is not, > never the equality operators. --- clang/tools/scan-build/bin/set-xcode-analyzer | 2 +- clang/utils/check_cfc/check_cfc.py | 4 ++-- lldb/examples/python/crashlog.py| 2 +- lldb/examples/python/disasm-stress-test.py | 4 ++-- lldb/examples/summaries/cocoa/CFString.py | 6 +++--- lldb/examples/summaries/pysummary.py| 2 +- lldb/examples/synthetic/bitfield/example.py | 2 +- lldb/packages/Python/lldbsuite/test/lldbtest.py | 2 +- lldb/test/API/commands/command/script/welcome.py| 2 +- .../commands/expression/call-throws/TestCallThatThrows.py | 6 +++--- .../disassemble/aarch64-adrp-add/TestAArch64AdrpAdd.py | 2 +- .../gdb_remote_client/TestNoWatchpointSupportInfo.py| 2 +- lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py | 2 +- lldb/test/API/tools/lldb-server/TestLldbGdbServer.py| 2 +- llvm/utils/indirect_calls.py| 2 +- openmp/libompd/gdb-plugin/ompd/ompd.py | 2 +- openmp/tools/archer/tests/lit.cfg | 2 +- .../External/isl/imath/tests/gmp-compat-test/genpytest.py | 2 +- 18 files changed, 24 insertions(+), 24 deletions(-) diff --git a/clang/tools/scan-build/bin/set-xcode-analyzer b/clang/tools/scan-build/bin/set-xcode-analyzer index f8c3f775ef7de..8d797bee4ae3b 100755 --- a/clang/tools/scan-build/bin/set-xcode-analyzer +++ b/clang/tools/scan-build/bin/set-xcode-analyzer @@ -107,7 +107,7 @@ def main(): foundSpec = True ModifySpec(x, isBuiltinAnalyzer, path) - if foundSpec == False: + if foundSpec is False: print "(-) No compiler configuration file was found. Xcode's analyzer has not been updated." if __name__ == '__main__': diff --git a/clang/utils/check_cfc/check_cfc.py b/clang/utils/check_cfc/check_cfc.py index 27d732d91030c..d4ddcb5bbb6a3 100755 --- a/clang/utils/check_cfc/check_cfc.py +++ b/clang/utils/check_cfc/check_cfc.py @@ -156,7 +156,7 @@ def get_output_file(args): elif arg.startswith("-o"): # Specified conjoined with -o return arg[2:] -assert grabnext == False +assert grabnext is False return None @@ -182,7 +182,7 @@ def replace_output_file(args, new_name): if replaceidx is None: raise Exception replacement = new_name -if attached == True: +if attached is True: replacement = "-o" + new_name args[replaceidx] = replacement return args diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 641b2e64d53b1..62bd73643a46e 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -166,7 +166,7 @@ def dump_symbolicated(self, crash_log, options): this_thread_crashed = self.app_specific_backtrace if not this_thread_crashed: this_thread_crashed = self.did_crash() -if options.crashed_only and this_thread_crashed == False: +if options.crashed_only and this_thread_crashed is False: return print("%s" % self) diff --git a/lldb/examples/python/disasm-stress-test.py b/lldb/examples/python/disasm-stress-test.py index 2d3314ee8e8ff..8487b24fdcba7 100755 --- a/lldb/examples/python/disasm-stress-test.py +++ b/lldb/examples/python/disasm-stress-test.py @@ -95,13 +95,13 @@ def GetLLDBFrameworkPath(): debugger = lldb.SBDebugger.Create() -if debugger.IsValid() == False: +if debugger.IsValid() is False: print("Couldn't create an SBDebugger") sys.exit(-1) target = debugger.CreateTargetWithFileAndArch(None, arg_ns.arch) -if target.IsValid() == False: +if target.IsValid() is False: print("Couldn't create an SBTarget for architecture " + arg_ns.arch) sys.exit(-1) diff --git a/lldb/examples/summaries/cocoa/CFString.py b/lldb/examples/summaries/cocoa/CFString.py index 13c294ca34122..fdea2c48870cb 100644 --- a/lldb/examples/summaries/cocoa/CFString.py +++ b/lldb/examples/summaries/cocoa/CFString.py @@ -253,9 +253,9 @@ def get_child_at_index(self, index): elif ( self.inline and self.explicit -and self.unicode == False -and self.special == False -and self.mutable == False +and self.unicode is False +and self.special is False +and self.mutable is False
[clang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [openmp] [polly] fix(python): fix comparison to None (PR #91857)
e-kwsm wrote: Commit message is updated/ https://github.com/llvm/llvm-project/pull/91857 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix comparison to None (PR #94014)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94014 >From b7b811f25c9937e92a067f44c9e1a91d9d42fe47 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(clang/**.py): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- clang/docs/DebuggingCoroutines.rst | 8 clang/tools/include-mapping/gen_std.py | 2 +- clang/utils/check_cfc/obj_diff.py | 2 +- clang/utils/module-deps-to-rsp.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 53bdd08fdbc02..7f464c1f4f28c 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -513,7 +513,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.coro_frame = coro_frame self.resume_func = dereference(self.coro_frame.resume_addr) self.resume_func_block = gdb.block_for_pc(self.resume_func) - if self.resume_func_block == None: + if self.resume_func_block is None: raise Exception('Not stackless coroutine.') self.line_info = gdb.find_pc_line(self.resume_func) @@ -543,8 +543,8 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.function_name = f def __str__(self, shift = 2): - addr = "" if self.address() == None else '%#x' % self.address() + " in " - location = "" if self.filename() == None else " at " + self.filename() + ":" + str(self.line()) + addr = "" if self.address() is None else '%#x' % self.address() + " in " + location = "" if self.filename() is None else " at " + self.filename() + ":" + str(self.line()) return addr + self.function() + " " + str([str(args) for args in self.frame_args()]) + location class CoroutineFilter: @@ -598,7 +598,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: addr = int(argv[0], 16) block = gdb.block_for_pc(long(cast_addr2long_pointer(addr).dereference())) - if block == None: + if block is None: print "block " + str(addr) + " is none." return diff --git a/clang/tools/include-mapping/gen_std.py b/clang/tools/include-mapping/gen_std.py index fcd3bd0d843ea..f362227bc6aab 100755 --- a/clang/tools/include-mapping/gen_std.py +++ b/clang/tools/include-mapping/gen_std.py @@ -215,7 +215,7 @@ def GetCCompatibilitySymbols(symbol): # Introduce two more entries, both in the global namespace, one using the # C++-compat header and another using the C header. results = [] -if symbol.namespace != None: +if symbol.namespace is not None: # avoid printing duplicated entries, for C macros! results.append(cppreference_parser.Symbol(symbol.name, None, [header])) c_header = "<" + header[2:-1] + ".h>" # => diff --git a/clang/utils/check_cfc/obj_diff.py b/clang/utils/check_cfc/obj_diff.py index 99ed19e522be2..9d602593a4e1a 100755 --- a/clang/utils/check_cfc/obj_diff.py +++ b/clang/utils/check_cfc/obj_diff.py @@ -57,7 +57,7 @@ def first_diff(a, b, fromfile, tofile): first_diff_idx = idx break -if first_diff_idx == None: +if first_diff_idx is None: # No difference return None diff --git a/clang/utils/module-deps-to-rsp.py b/clang/utils/module-deps-to-rsp.py index 6c9f263a786ef..b57a44e5c8780 100755 --- a/clang/utils/module-deps-to-rsp.py +++ b/clang/utils/module-deps-to-rsp.py @@ -74,7 +74,7 @@ def main(): if args.module_name: cmd = findModule(args.module_name, full_deps)["command-line"] -elif args.tu_index != None: +elif args.tu_index is not None: tu = full_deps.translation_units[args.tu_index] cmd = tu["commands"][args.tu_cmd_index]["command-line"] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94029 >From 5ad3e5603357698d08a66c7a7c92d198a3c24789 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 10 +- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 705ff0d4d4098..d47111819a1e2 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -86,11 +86,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -101,9 +101,9 @@ def extract_result_types(comment): def strip_doxygen(comment): -"""Returns the given comment without \-escaped words.""" +r"""Returns the given comment without \-escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. @@ -236,7 +236,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse the various matcher definition macros. m = re.match( -""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( +r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0..43968f4b1b6e8 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix comparison to None (PR #94014)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94014 >From 3fcf81d949e461fb91b4e1713365da29ae1078cd Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(clang/**.py): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- clang/docs/DebuggingCoroutines.rst | 8 clang/tools/include-mapping/gen_std.py | 2 +- clang/utils/check_cfc/obj_diff.py | 2 +- clang/utils/module-deps-to-rsp.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 53bdd08fdbc02f..7f464c1f4f28ca 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -513,7 +513,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.coro_frame = coro_frame self.resume_func = dereference(self.coro_frame.resume_addr) self.resume_func_block = gdb.block_for_pc(self.resume_func) - if self.resume_func_block == None: + if self.resume_func_block is None: raise Exception('Not stackless coroutine.') self.line_info = gdb.find_pc_line(self.resume_func) @@ -543,8 +543,8 @@ So we can use the ``continuation`` field to construct the asynchronous stack: self.function_name = f def __str__(self, shift = 2): - addr = "" if self.address() == None else '%#x' % self.address() + " in " - location = "" if self.filename() == None else " at " + self.filename() + ":" + str(self.line()) + addr = "" if self.address() is None else '%#x' % self.address() + " in " + location = "" if self.filename() is None else " at " + self.filename() + ":" + str(self.line()) return addr + self.function() + " " + str([str(args) for args in self.frame_args()]) + location class CoroutineFilter: @@ -598,7 +598,7 @@ So we can use the ``continuation`` field to construct the asynchronous stack: addr = int(argv[0], 16) block = gdb.block_for_pc(long(cast_addr2long_pointer(addr).dereference())) - if block == None: + if block is None: print "block " + str(addr) + " is none." return diff --git a/clang/tools/include-mapping/gen_std.py b/clang/tools/include-mapping/gen_std.py index fcd3bd0d843ea1..f362227bc6aab9 100755 --- a/clang/tools/include-mapping/gen_std.py +++ b/clang/tools/include-mapping/gen_std.py @@ -215,7 +215,7 @@ def GetCCompatibilitySymbols(symbol): # Introduce two more entries, both in the global namespace, one using the # C++-compat header and another using the C header. results = [] -if symbol.namespace != None: +if symbol.namespace is not None: # avoid printing duplicated entries, for C macros! results.append(cppreference_parser.Symbol(symbol.name, None, [header])) c_header = "<" + header[2:-1] + ".h>" # => diff --git a/clang/utils/check_cfc/obj_diff.py b/clang/utils/check_cfc/obj_diff.py index 99ed19e522be20..9d602593a4e1a9 100755 --- a/clang/utils/check_cfc/obj_diff.py +++ b/clang/utils/check_cfc/obj_diff.py @@ -57,7 +57,7 @@ def first_diff(a, b, fromfile, tofile): first_diff_idx = idx break -if first_diff_idx == None: +if first_diff_idx is None: # No difference return None diff --git a/clang/utils/module-deps-to-rsp.py b/clang/utils/module-deps-to-rsp.py index 6c9f263a786efc..b57a44e5c87809 100755 --- a/clang/utils/module-deps-to-rsp.py +++ b/clang/utils/module-deps-to-rsp.py @@ -74,7 +74,7 @@ def main(): if args.module_name: cmd = findModule(args.module_name, full_deps)["command-line"] -elif args.tu_index != None: +elif args.tu_index is not None: tu = full_deps.translation_units[args.tu_index] cmd = tu["commands"][args.tu_cmd_index]["command-line"] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix comparison to None (PR #94014)
e-kwsm wrote: This PR is ready but I have no permission. https://github.com/llvm/llvm-project/pull/94014 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94029 >From 93cb19e83e2b547f0a047a7f93ade40ffc4391c0 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 10 +- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 705ff0d4d40985..d47111819a1e2d 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -86,11 +86,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -101,9 +101,9 @@ def extract_result_types(comment): def strip_doxygen(comment): -"""Returns the given comment without \-escaped words.""" +r"""Returns the given comment without \-escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. @@ -236,7 +236,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse the various matcher definition macros. m = re.match( -""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( +r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0c..43968f4b1b6e8d 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94029 >From 8ebfa30beff75a80601ae88c878beffe31a3f310 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 10 +- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 705ff0d4d40985..d47111819a1e2d 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -86,11 +86,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -101,9 +101,9 @@ def extract_result_types(comment): def strip_doxygen(comment): -"""Returns the given comment without \-escaped words.""" +r"""Returns the given comment without \-escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. @@ -236,7 +236,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse the various matcher definition macros. m = re.match( -""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( +r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0c..43968f4b1b6e8d 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94029 >From e6ea87dd5ed5a2484f9526fe5b72c87178582a0e Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 10 +- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index b6f00657ec914c..c94a533f4c68f2 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -91,11 +91,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -106,9 +106,9 @@ def extract_result_types(comment): def strip_doxygen(comment): -"""Returns the given comment without \-escaped words.""" +r"""Returns the given comment without \-escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. @@ -241,7 +241,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse the various matcher definition macros. m = re.match( -""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( +r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0c..43968f4b1b6e8d 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94029 >From 6f595ed1b04efa15b0085ae212f847163a131f17 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 10 +- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index b6f00657ec914c..c94a533f4c68f2 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -91,11 +91,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -106,9 +106,9 @@ def extract_result_types(comment): def strip_doxygen(comment): -"""Returns the given comment without \-escaped words.""" +r"""Returns the given comment without \-escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. @@ -241,7 +241,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse the various matcher definition macros. m = re.match( -""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( +r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0c..43968f4b1b6e8d 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94029 >From 511dda8045630f775d96805510f730aebbfc3680 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 10 +- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index b6f00657ec914c..c94a533f4c68f2 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -91,11 +91,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -106,9 +106,9 @@ def extract_result_types(comment): def strip_doxygen(comment): -"""Returns the given comment without \-escaped words.""" +r"""Returns the given comment without \-escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. @@ -241,7 +241,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse the various matcher definition macros. m = re.match( -""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( +r""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0c..43968f4b1b6e8d 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fix(clang/**.py): fix invalid escape sequences (PR #94029)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94029 >From a1256602c10df2beb7b244a75e75c22b7203ea02 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(clang/**.py): fix invalid escape sequences --- clang/docs/tools/dump_ast_matchers.py | 6 +++--- clang/test/Analysis/check-analyzer-fixit.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 46b7bb718ba08..41ee468adaa47 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -91,11 +91,11 @@ def extract_result_types(comment): parsed. """ result_types = [] -m = re.search(r"Usable as: Any Matcher[\s\n]*$", comment, re.S) +m = re.search("Usable as: Any Matcher[\\s\n]*$", comment, re.S) if m: return ["*"] while True: -m = re.match(r"^(.*)Matcher<([^>]+)>\s*,?[\s\n]*$", comment, re.S) +m = re.match("^(.*)Matcher<([^>]+)>\\s*,?[\\s\n]*$", comment, re.S) if not m: if re.search(r"Usable as:\s*$", comment): return result_types @@ -108,7 +108,7 @@ def extract_result_types(comment): def strip_doxygen(comment): """Returns the given comment without -escaped words.""" # If there is only a doxygen keyword in the line, delete the whole line. -comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) +comment = re.sub("^[^\\s]+\n", r"", comment, flags=re.M) # If there is a doxygen \see command, change the \see prefix into "See also:". # FIXME: it would be better to turn this into a link to the target instead. diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py index b616255de89b0..43968f4b1b6e8 100644 --- a/clang/test/Analysis/check-analyzer-fixit.py +++ b/clang/test/Analysis/check-analyzer-fixit.py @@ -55,7 +55,7 @@ def run_test_once(args, extra_args): # themselves. We need to keep the comments to preserve line numbers while # avoiding empty lines which could potentially trigger formatting-related # checks. -cleaned_test = re.sub("// *CHECK-[A-Z0-9\-]*:[^\r\n]*", "//", input_text) +cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits