[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
DavidSpickett wrote: The code looks ok but as landed it turned `A && B && C` into `A || B || C`, despite that looking logical. @medismailben can you figure out the intent here, I'm assuming this was your code originally. https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-x86_64-debian` running on `lldb-x86_64-debian` while building `lldb` at step 6 "test". Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/2857 Here is the relevant piece of the build log for the reference: ``` Step 6 (test) failure: build (failure) ... PASS: lldb-api :: python_api/module_section/TestModuleAndSection.py (88 of 2633) PASS: lldb-api :: commands/expression/timeout/TestCallWithTimeout.py (89 of 2633) PASS: lldb-api :: commands/expression/persistent_result/TestPersistentResult.py (90 of 2633) PASS: lldb-api :: functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py (91 of 2633) PASS: lldb-api :: commands/gui/breakpoints/TestGuiBreakpoints.py (92 of 2633) PASS: lldb-api :: python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (93 of 2633) PASS: lldb-api :: tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py (94 of 2633) PASS: lldb-api :: api/listeners/TestListener.py (95 of 2633) PASS: lldb-api :: functionalities/step-vrs-interrupt/TestStepVrsInterruptTimeout.py (96 of 2633) PASS: lldb-api :: tools/lldb-server/TestGdbRemote_vCont.py (97 of 2633) FAIL: lldb-api :: functionalities/postmortem/mach-core/TestMachCore.py (98 of 2633) TEST 'lldb-api :: functionalities/postmortem/mach-core/TestMachCore.py' FAILED Script: -- /usr/bin/python3 /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/bin/ar --env OBJCOPY=/usr/bin/objcopy --env LLVM_LIBS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --env LLVM_INCLUDE_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/include --env LLVM_TOOLS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --arch x86_64 --build-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex --lldb-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/lldb --compiler /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/clang --dsymutil /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/dsymutil --llvm-tools-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./bin --lldb-obj-root /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb --lldb-libs-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./lib -t /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/postmortem/mach-core -p TestMachCore.py -- Exit Code: 1 Command Output (stdout): -- lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision 2ba3fe7356f065757a2279f65e4ef5c8f1476293) clang revision 2ba3fe7356f065757a2279f65e4ef5c8f1476293 llvm revision 2ba3fe7356f065757a2279f65e4ef5c8f1476293 Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc'] -- Command Output (stderr): -- Change dir to: /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/postmortem/mach-core runCmd: settings clear -all output: runCmd: settings set symbols.enable-external-lookup false output: runCmd: settings set target.inherit-tcc true output: runCmd: settings set target.disable-aslr false output: runCmd: settings set target.detach-on-error false output: ``` https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
https://github.com/xgupta closed https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
https://github.com/xgupta edited https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
https://github.com/bulbazord approved this pull request. The change looks good to me. Please make sure you update the commit message so it accurately reflects the change since there were a few revisions. :) https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
@@ -85,13 +85,17 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name && !has_interpreter_dict && !script_obj) { - if (!has_class_name) -return create_error("Missing script class name."); - else if (!has_interpreter_dict) -return create_error("Invalid script interpreter dictionary."); - else -return create_error("Missing scripting object."); + +if (!has_class_name) { + return create_error("Missing script class name."); +} xgupta wrote: Sure, thanks. https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
https://github.com/xgupta updated https://github.com/llvm/llvm-project/pull/94779 >From b8a387d82ed90c98f6bc9c0c7f9bc9da0d8e4d18 Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Fri, 7 Jun 2024 23:21:15 +0530 Subject: [PATCH 1/3] [LLDB][NFC] Fix a cppcheck warning in Python/Interfaces/ScriptedPythonInterface.h Fix #89195 --- .../Python/Interfaces/ScriptedPythonInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h index 163659234466d..30811639c9a95 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h @@ -85,7 +85,7 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name && !has_interpreter_dict && !script_obj) { +if (!has_class_name || !has_interpreter_dict || !script_obj) { if (!has_class_name) return create_error("Missing script class name."); else if (!has_interpreter_dict) >From 7a53eeb7c42c79f7637a8900a02e782f385d494f Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Wed, 19 Jun 2024 13:46:57 +0530 Subject: [PATCH 2/3] simplify condition --- .../Interfaces/ScriptedPythonInterface.h | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h index 30811639c9a95..3d7c640a686ae 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h @@ -85,13 +85,17 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name || !has_interpreter_dict || !script_obj) { - if (!has_class_name) -return create_error("Missing script class name."); - else if (!has_interpreter_dict) -return create_error("Invalid script interpreter dictionary."); - else -return create_error("Missing scripting object."); + +if (!has_class_name) { + return create_error("Missing script class name."); +} + +if (!has_interpreter_dict) { + return create_error("Invalid script interpreter dictionary."); +} + +if (!script_obj) { + return create_error("Missing scripting object."); } Locker py_lock(_interpreter, Locker::AcquireLock | Locker::NoSTDIN, >From 93a6edb2e5cfeca2eccbc6b70ad8a06476c99210 Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Sat, 6 Jul 2024 09:21:30 +0200 Subject: [PATCH 3/3] address review comment --- .../Python/Interfaces/ScriptedPythonInterface.h | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h index 3d7c640a686ae..9e859ec4b3653 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h @@ -86,17 +86,14 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name) { +if (!has_class_name) return create_error("Missing script class name."); -} -if (!has_interpreter_dict) { +if (!has_interpreter_dict) return create_error("Invalid script interpreter dictionary."); -} -if (!script_obj) { +if (!script_obj) return create_error("Missing scripting object."); -} Locker py_lock(_interpreter, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
@@ -85,13 +85,17 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name && !has_interpreter_dict && !script_obj) { - if (!has_class_name) -return create_error("Missing script class name."); - else if (!has_interpreter_dict) -return create_error("Invalid script interpreter dictionary."); - else -return create_error("Missing scripting object."); + +if (!has_class_name) { + return create_error("Missing script class name."); +} DavidSpickett wrote: https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
https://github.com/xgupta updated https://github.com/llvm/llvm-project/pull/94779 >From b8a387d82ed90c98f6bc9c0c7f9bc9da0d8e4d18 Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Fri, 7 Jun 2024 23:21:15 +0530 Subject: [PATCH 1/2] [LLDB][NFC] Fix a cppcheck warning in Python/Interfaces/ScriptedPythonInterface.h Fix #89195 --- .../Python/Interfaces/ScriptedPythonInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h index 163659234466d..30811639c9a95 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h @@ -85,7 +85,7 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name && !has_interpreter_dict && !script_obj) { +if (!has_class_name || !has_interpreter_dict || !script_obj) { if (!has_class_name) return create_error("Missing script class name."); else if (!has_interpreter_dict) >From 7a53eeb7c42c79f7637a8900a02e782f385d494f Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Wed, 19 Jun 2024 13:46:57 +0530 Subject: [PATCH 2/2] simplify condition --- .../Interfaces/ScriptedPythonInterface.h | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h index 30811639c9a95..3d7c640a686ae 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h @@ -85,13 +85,17 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name || !has_interpreter_dict || !script_obj) { - if (!has_class_name) -return create_error("Missing script class name."); - else if (!has_interpreter_dict) -return create_error("Invalid script interpreter dictionary."); - else -return create_error("Missing scripting object."); + +if (!has_class_name) { + return create_error("Missing script class name."); +} + +if (!has_interpreter_dict) { + return create_error("Invalid script interpreter dictionary."); +} + +if (!script_obj) { + return create_error("Missing scripting object."); } Locker py_lock(_interpreter, Locker::AcquireLock | Locker::NoSTDIN, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
@@ -85,7 +85,7 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name && !has_interpreter_dict && !script_obj) { +if (!has_class_name || !has_interpreter_dict || !script_obj) { if (!has_class_name) adrian-prantl wrote: it would be better to hoist this above the previous condition? https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
xgupta wrote: Gentile ping! https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
https://github.com/xgupta edited https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
https://github.com/xgupta edited https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits