-
Notifications
You must be signed in to change notification settings - Fork 13.5k
fix(python): fix comparison to None #91857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-bolt @llvm/pr-subscribers-compiler-rt-sanitizer Author: Eisuke Kawashima (e-kwsm) ChangesPatch is 35.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/91857.diff 50 Files Affected:
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)
@@ -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>" # <cstdio> => <stdio.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"]
diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py
index 83b3cbe789cac..7491568e55808 100644
--- a/compiler-rt/test/asan/lit.cfg.py
+++ b/compiler-rt/test/asan/lit.cfg.py
@@ -10,7 +10,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py
index f63d15919888e..c18c973d54c13 100644
--- a/compiler-rt/test/builtins/Unit/lit.cfg.py
+++ b/compiler-rt/test/builtins/Unit/lit.cfg.py
@@ -21,7 +21,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/ctx_profile/lit.cfg.py b/compiler-rt/test/ctx_profile/lit.cfg.py
index a56dabb8ebeb3..1bcfc6485ef8e 100644
--- a/compiler-rt/test/ctx_profile/lit.cfg.py
+++ b/compiler-rt/test/ctx_profile/lit.cfg.py
@@ -13,7 +13,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/lsan/lit.common.cfg.py b/compiler-rt/test/lsan/lit.common.cfg.py
index e9b974955730d..9426b7d108bbf 100644
--- a/compiler-rt/test/lsan/lit.common.cfg.py
+++ b/compiler-rt/test/lsan/lit.common.cfg.py
@@ -10,7 +10,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/memprof/lit.cfg.py b/compiler-rt/test/memprof/lit.cfg.py
index 4e5d7ba405a20..4057da0c65b51 100644
--- a/compiler-rt/test/memprof/lit.cfg.py
+++ b/compiler-rt/test/memprof/lit.cfg.py
@@ -9,7 +9,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/profile/lit.cfg.py b/compiler-rt/test/profile/lit.cfg.py
index d3ba115731c5d..191947e4f64aa 100644
--- a/compiler-rt/test/profile/lit.cfg.py
+++ b/compiler-rt/test/profile/lit.cfg.py
@@ -6,7 +6,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/sanitizer_common/android_commands/android_compile.py b/compiler-rt/test/sanitizer_common/android_commands/android_compile.py
index f86831ffef899..e9c6738a09a3f 100755
--- a/compiler-rt/test/sanitizer_common/android_commands/android_compile.py
+++ b/compiler-rt/test/sanitizer_common/android_commands/android_compile.py
@@ -20,7 +20,7 @@
elif arg == "-o":
output = args.pop(0)
-if output == None:
+if output is None:
print("No output file name!")
sys.exit(1)
diff --git a/compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py b/compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py
index 39b211b093c92..2eac1a9bab455 100755
--- a/compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py
+++ b/compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py
@@ -19,7 +19,7 @@
elif arg == "-o":
output = args.pop(0)
-if output == None:
+if output is None:
print("No output file name!")
sys.exit(1)
diff --git a/compiler-rt/test/ubsan/lit.common.cfg.py b/compiler-rt/test/ubsan/lit.common.cfg.py
index 61f6818cce064..04d6f24de5a9f 100644
--- a/compiler-rt/test/ubsan/lit.common.cfg.py
+++ b/compiler-rt/test/ubsan/lit.common.cfg.py
@@ -5,7 +5,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
index d398d3a0a8162..e60aed6512fb9 100644
--- a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
+++ b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
@@ -5,7 +5,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py b/cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py
index 29d7867e80867..4b086e14d4050 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py
@@ -98,7 +98,7 @@ def _build_command(
def label_to_line(label_name: str) -> int:
line = labels.get(label_name, None)
- if line != None:
+ if line is not None:
return line
raise format_unresolved_label_err(label_name, raw_text, path.base, lineno)
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py
index a7d6b570b55e8..ac3054c3a0edf 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py
@@ -62,7 +62,7 @@ def __init__(
self.finish_on_remove = finish_on_remove
def has_conditions(self):
- return self.expression != None
+ return self.expression is not None
def get_conditional_expression_list(self):
conditional_list = []
@@ -76,7 +76,7 @@ def add_hit(self):
self.current_hit_count += 1
def should_be_removed(self):
- if self.max_hit_count == None:
+ if self.max_hit_count is None:
return False
return self.current_hit_count >= self.max_hit_count
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py
index 3e5a7b919d703..a4ca5ae0158e9 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py
@@ -39,7 +39,7 @@ def update_step_watches(step_info, watches, commands):
for watch in towatch:
loc = step_info.current_location
if (
- loc.path != None
+ loc.path is not None
and os.path.exists(loc.path)
and os.path.samefile(watch.path, loc.path)
and have_hit_line(watch, loc)
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py
index 1b0d4d5871cbe..67b715af78698 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py
@@ -183,7 +183,7 @@ def handle_debugger_tool_options(context, defaults): # noqa
if options.debugger == "lldb":
_warn_meaningless_option(context, "--show-debugger")
- if options.source_root_dir != None:
+ if options.source_root_dir is not None:
if not os.path.isabs(options.source_root_dir):
raise ToolArgumentError(
f'<d>--source-root-dir: expected absolute path, got</> <r>"{options.source_root_dir}"</>'
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py
index 0e20cfbbd264b..f87e1312819e2 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py
@@ -235,7 +235,7 @@ def delete_breakpoints(self, ids):
for bp in self._debugger.Breakpoints:
# We're looking at the user-set breakpoints so there should be no
# Parent.
- assert bp.Parent == None
+ assert bp.Parent is None
this_vsbp = VSBreakpoint(
PurePath(bp.File), bp.FileLine, bp.FileColumn, bp.Condition
)
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py b/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py
index f07641041254b..c366062cec7a9 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py
@@ -150,7 +150,7 @@ def _get_results_path(self, test_name):
"""Returns the path to the test results directory for the test denoted
by test_name.
"""
- assert self.context.options.results_directory != None
+ assert self.context.options.results_directory is not None
return os.path.join(
self.context.options.results_directory,
self._get_results_basename(test_name),
diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py
index 774c4eaf4d976..6341d5c300d86 100644
--- a/cross-project-tests/lit.cfg.py
+++ b/cross-project-tests/lit.cfg.py
@@ -54,7 +54,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/lldb/docs/use/python.rst b/lldb/docs/use/python.rst
index 6183d6935d80e..d9c29d95708c1 100644
--- a/lldb/docs/use/python.rst
+++ b/lldb/docs/use/python.rst
@@ -75,13 +75,13 @@ later explanations:
12: if root_word == word:
13: return cur_path
14: elif word < root_word:
- 15: if left_child_ptr.GetValue() == None:
+ 15: if left_child_ptr.GetValue() is None:
16: return ""
17: else:
18: cur_path = cur_path + "L"
19: return DFS (left_child_ptr, word, cur_path)
20: else:
- 21: if right_child_ptr.GetValue() == None:
+ 21: if right_child_ptr.GetValue() is None:
22: return ""
23: else:
24: cur_path = cur_path + "R"
diff --git a/lldb/examples/python/armv7_cortex_m_target_defintion.py b/lldb/examples/python/armv7_cortex_m_target_defintion.py
index 42eaa39993dae..8225670f33e6b 100755
--- a/lldb/examples/python/armv7_cortex_m_target_defintion.py
+++ b/lldb/examples/python/armv7_cortex_m_target_defintion.py
@@ -222,7 +222,7 @@ def get_reg_num(reg_num_dict, reg_name):
def get_target_definition():
global g_target_definition
- if g_target_definition == None:
+ if g_target_definition is None:
g_target_definition = {}
offset = 0
for reg_info in armv7_register_infos:
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index ebabf348643ef..d6757f000c14d 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -47,7 +47,7 @@
def is_exe(fpath):
"""Returns true if fpath is an executable."""
- if fpath == None:
+ if fpath is None:
return False
if sys.platform == "win32":
if not fpath.endswith(".exe"):
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 5fd686c143e9f..cb3ae0e422975 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -229,7 +229,7 @@ def pointer_size():
def is_exe(fpath):
"""Returns true if fpath is an executable."""
- if fpath == None:
+ if fpath is None:
return False
if sys.platform == "win32":
if not fpath.endswith(".exe"):
@@ -2191,7 +2191,7 @@ def complete_from_to(self, str_input, patterns):
if num_matches == 0:
compare_string = str_input
else:
- if common_match != None and len(common_match) > 0:
+ if common_match is not None and len(common_match) > 0:
compare_string = str_input + common_match
else:
compare_string = ""
@@ -2552,7 +2552,7 @@ def assertFailure(self, obj, error_str=None, msg=None):
if obj.Success():
self.fail(self._formatMessage(msg, "Error not in a fail state"))
- if error_str == None:
+ if error_str is None:
return
error = obj.GetCString()
diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 58eb37fd742d7..629d8ce494b85 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -1594,11 +1594,11 @@ def set_actions_for_signal(
):
return_obj = lldb.SBCommandReturnObject()
command = "process handle {0}".format(signal_name)
- if pass_action != None:
+ if pass_action is not None:
command += " -p {0}".format(pass_action)
- if stop_action != None:
+ if stop_action is not None:
command += " -s {0}".format(stop_action)
- if notify_action != None:
+ if notify_action is not None:
command += " -n {0}".format(notify_action)
testcase.dbg.GetCommandInterpreter().HandleCommand(command, return_obj)
diff --git a/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
index fd1eb64219585..f1b7d7c33bf07 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
@@ -134,7 +134,7 @@ def traceStartProcess(
self.assertSBError(trace.Start(configuration), error=error)
else:
command = "process trace start"
- if processBufferSizeLimit != None:
+ if processBufferSizeLimit is not None:
command += " -l " + str(processBufferSizeLimit)
if enableTsc:
command += " --tsc"
diff --git a/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
index d120692e4d6e6..3674a8c233c8d 100644
--- a/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
+++ b/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
@@ -32,7 +32,7 @@ def address_breakpoints(self):
...
[truncated]
|
@llvm/pr-subscribers-clang Author: Eisuke Kawashima (e-kwsm) ChangesPatch is 35.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/91857.diff 50 Files Affected:
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)
@@ -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>" # <cstdio> => <stdio.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"]
diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py
index 83b3cbe789cac..7491568e55808 100644
--- a/compiler-rt/test/asan/lit.cfg.py
+++ b/compiler-rt/test/asan/lit.cfg.py
@@ -10,7 +10,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py
index f63d15919888e..c18c973d54c13 100644
--- a/compiler-rt/test/builtins/Unit/lit.cfg.py
+++ b/compiler-rt/test/builtins/Unit/lit.cfg.py
@@ -21,7 +21,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/ctx_profile/lit.cfg.py b/compiler-rt/test/ctx_profile/lit.cfg.py
index a56dabb8ebeb3..1bcfc6485ef8e 100644
--- a/compiler-rt/test/ctx_profile/lit.cfg.py
+++ b/compiler-rt/test/ctx_profile/lit.cfg.py
@@ -13,7 +13,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/lsan/lit.common.cfg.py b/compiler-rt/test/lsan/lit.common.cfg.py
index e9b974955730d..9426b7d108bbf 100644
--- a/compiler-rt/test/lsan/lit.common.cfg.py
+++ b/compiler-rt/test/lsan/lit.common.cfg.py
@@ -10,7 +10,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/memprof/lit.cfg.py b/compiler-rt/test/memprof/lit.cfg.py
index 4e5d7ba405a20..4057da0c65b51 100644
--- a/compiler-rt/test/memprof/lit.cfg.py
+++ b/compiler-rt/test/memprof/lit.cfg.py
@@ -9,7 +9,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/profile/lit.cfg.py b/compiler-rt/test/profile/lit.cfg.py
index d3ba115731c5d..191947e4f64aa 100644
--- a/compiler-rt/test/profile/lit.cfg.py
+++ b/compiler-rt/test/profile/lit.cfg.py
@@ -6,7 +6,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/sanitizer_common/android_commands/android_compile.py b/compiler-rt/test/sanitizer_common/android_commands/android_compile.py
index f86831ffef899..e9c6738a09a3f 100755
--- a/compiler-rt/test/sanitizer_common/android_commands/android_compile.py
+++ b/compiler-rt/test/sanitizer_common/android_commands/android_compile.py
@@ -20,7 +20,7 @@
elif arg == "-o":
output = args.pop(0)
-if output == None:
+if output is None:
print("No output file name!")
sys.exit(1)
diff --git a/compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py b/compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py
index 39b211b093c92..2eac1a9bab455 100755
--- a/compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py
+++ b/compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py
@@ -19,7 +19,7 @@
elif arg == "-o":
output = args.pop(0)
-if output == None:
+if output is None:
print("No output file name!")
sys.exit(1)
diff --git a/compiler-rt/test/ubsan/lit.common.cfg.py b/compiler-rt/test/ubsan/lit.common.cfg.py
index 61f6818cce064..04d6f24de5a9f 100644
--- a/compiler-rt/test/ubsan/lit.common.cfg.py
+++ b/compiler-rt/test/ubsan/lit.common.cfg.py
@@ -5,7 +5,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
index d398d3a0a8162..e60aed6512fb9 100644
--- a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
+++ b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
@@ -5,7 +5,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py b/cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py
index 29d7867e80867..4b086e14d4050 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py
@@ -98,7 +98,7 @@ def _build_command(
def label_to_line(label_name: str) -> int:
line = labels.get(label_name, None)
- if line != None:
+ if line is not None:
return line
raise format_unresolved_label_err(label_name, raw_text, path.base, lineno)
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py
index a7d6b570b55e8..ac3054c3a0edf 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py
@@ -62,7 +62,7 @@ def __init__(
self.finish_on_remove = finish_on_remove
def has_conditions(self):
- return self.expression != None
+ return self.expression is not None
def get_conditional_expression_list(self):
conditional_list = []
@@ -76,7 +76,7 @@ def add_hit(self):
self.current_hit_count += 1
def should_be_removed(self):
- if self.max_hit_count == None:
+ if self.max_hit_count is None:
return False
return self.current_hit_count >= self.max_hit_count
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py
index 3e5a7b919d703..a4ca5ae0158e9 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py
@@ -39,7 +39,7 @@ def update_step_watches(step_info, watches, commands):
for watch in towatch:
loc = step_info.current_location
if (
- loc.path != None
+ loc.path is not None
and os.path.exists(loc.path)
and os.path.samefile(watch.path, loc.path)
and have_hit_line(watch, loc)
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py
index 1b0d4d5871cbe..67b715af78698 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py
@@ -183,7 +183,7 @@ def handle_debugger_tool_options(context, defaults): # noqa
if options.debugger == "lldb":
_warn_meaningless_option(context, "--show-debugger")
- if options.source_root_dir != None:
+ if options.source_root_dir is not None:
if not os.path.isabs(options.source_root_dir):
raise ToolArgumentError(
f'<d>--source-root-dir: expected absolute path, got</> <r>"{options.source_root_dir}"</>'
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py
index 0e20cfbbd264b..f87e1312819e2 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py
@@ -235,7 +235,7 @@ def delete_breakpoints(self, ids):
for bp in self._debugger.Breakpoints:
# We're looking at the user-set breakpoints so there should be no
# Parent.
- assert bp.Parent == None
+ assert bp.Parent is None
this_vsbp = VSBreakpoint(
PurePath(bp.File), bp.FileLine, bp.FileColumn, bp.Condition
)
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py b/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py
index f07641041254b..c366062cec7a9 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py
@@ -150,7 +150,7 @@ def _get_results_path(self, test_name):
"""Returns the path to the test results directory for the test denoted
by test_name.
"""
- assert self.context.options.results_directory != None
+ assert self.context.options.results_directory is not None
return os.path.join(
self.context.options.results_directory,
self._get_results_basename(test_name),
diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py
index 774c4eaf4d976..6341d5c300d86 100644
--- a/cross-project-tests/lit.cfg.py
+++ b/cross-project-tests/lit.cfg.py
@@ -54,7 +54,7 @@
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
- if attr_value == None:
+ if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
diff --git a/lldb/docs/use/python.rst b/lldb/docs/use/python.rst
index 6183d6935d80e..d9c29d95708c1 100644
--- a/lldb/docs/use/python.rst
+++ b/lldb/docs/use/python.rst
@@ -75,13 +75,13 @@ later explanations:
12: if root_word == word:
13: return cur_path
14: elif word < root_word:
- 15: if left_child_ptr.GetValue() == None:
+ 15: if left_child_ptr.GetValue() is None:
16: return ""
17: else:
18: cur_path = cur_path + "L"
19: return DFS (left_child_ptr, word, cur_path)
20: else:
- 21: if right_child_ptr.GetValue() == None:
+ 21: if right_child_ptr.GetValue() is None:
22: return ""
23: else:
24: cur_path = cur_path + "R"
diff --git a/lldb/examples/python/armv7_cortex_m_target_defintion.py b/lldb/examples/python/armv7_cortex_m_target_defintion.py
index 42eaa39993dae..8225670f33e6b 100755
--- a/lldb/examples/python/armv7_cortex_m_target_defintion.py
+++ b/lldb/examples/python/armv7_cortex_m_target_defintion.py
@@ -222,7 +222,7 @@ def get_reg_num(reg_num_dict, reg_name):
def get_target_definition():
global g_target_definition
- if g_target_definition == None:
+ if g_target_definition is None:
g_target_definition = {}
offset = 0
for reg_info in armv7_register_infos:
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index ebabf348643ef..d6757f000c14d 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -47,7 +47,7 @@
def is_exe(fpath):
"""Returns true if fpath is an executable."""
- if fpath == None:
+ if fpath is None:
return False
if sys.platform == "win32":
if not fpath.endswith(".exe"):
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 5fd686c143e9f..cb3ae0e422975 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -229,7 +229,7 @@ def pointer_size():
def is_exe(fpath):
"""Returns true if fpath is an executable."""
- if fpath == None:
+ if fpath is None:
return False
if sys.platform == "win32":
if not fpath.endswith(".exe"):
@@ -2191,7 +2191,7 @@ def complete_from_to(self, str_input, patterns):
if num_matches == 0:
compare_string = str_input
else:
- if common_match != None and len(common_match) > 0:
+ if common_match is not None and len(common_match) > 0:
compare_string = str_input + common_match
else:
compare_string = ""
@@ -2552,7 +2552,7 @@ def assertFailure(self, obj, error_str=None, msg=None):
if obj.Success():
self.fail(self._formatMessage(msg, "Error not in a fail state"))
- if error_str == None:
+ if error_str is None:
return
error = obj.GetCString()
diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 58eb37fd742d7..629d8ce494b85 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -1594,11 +1594,11 @@ def set_actions_for_signal(
):
return_obj = lldb.SBCommandReturnObject()
command = "process handle {0}".format(signal_name)
- if pass_action != None:
+ if pass_action is not None:
command += " -p {0}".format(pass_action)
- if stop_action != None:
+ if stop_action is not None:
command += " -s {0}".format(stop_action)
- if notify_action != None:
+ if notify_action is not None:
command += " -n {0}".format(notify_action)
testcase.dbg.GetCommandInterpreter().HandleCommand(command, return_obj)
diff --git a/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
index fd1eb64219585..f1b7d7c33bf07 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
@@ -134,7 +134,7 @@ def traceStartProcess(
self.assertSBError(trace.Start(configuration), error=error)
else:
command = "process trace start"
- if processBufferSizeLimit != None:
+ if processBufferSizeLimit is not None:
command += " -l " + str(processBufferSizeLimit)
if enableTsc:
command += " --tsc"
diff --git a/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
index d120692e4d6e6..3674a8c233c8d 100644
--- a/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
+++ b/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
@@ -32,7 +32,7 @@ def address_breakpoints(self):
...
[truncated]
|
Please provide a proper patch description, i.e., why the change is being made. |
This should be included in the actual commit, not GitHub comments. |
Commit message is updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the MLIR part. Please seek approval from relevant reviewers for all other subprojects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the ctx_profile
part.
LLVM uses a GitHub setting where the PR is squashed, and the commit message is taken from the PR description rather than the commits themselves. So all you have to do here is copy the commit message you updated into the PR's description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LLDB changes look good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compiler-rt changes lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should really be broken up into separate PRs per subproject. One large PR like this makes reviewing harder and causes unnecessary churn in the case that this gets reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can push this to main in separate commits (one per project as it was mentioned?), that'd be great!
It's a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not unless you subscribe only to a subproject. FWIW, I'm not comfortable blanket approving changes, however trivial, to subprojects I'm not actively working on, and I suspect most folks here are not. Subprojects may have some ongoing work that will be disrupted or reasons why they chose the suboptimal implementation. |
In addition to what @ftynse said above, the |
On my I'm not asking for more reviews, this is why I commented that this should be pushed in multiple commits, I don't even need to see PRs. Another thing also mentioned above was the problem of reverts. More commits in the history for unrelated projects does not seem like "noise" to me. When I apply automated linter (clang-tidy), I will split these into 1 commit per file and push these. |
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 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.
No description provided.