[Lldb-commits] [PATCH] D82558: [LLDB][NFC] Remove redundant condition

Balogh, Ádám via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 25 08:02:24 PDT 2020


baloghadamsoftware created this revision.
baloghadamsoftware added a reviewer: clayborg.
baloghadamsoftware added a project: LLDB.
Herald added subscribers: martong, gamesh411, Szelethus, dkrupp, rnkovacs, kbarton, kristof.beyls, nemanjai.

Condition `auto_advance_pc` is checked both in an outer and in an inner `if` statement in `EmulateInstructionARM::EvaluateInstruction()`, `EmulateInstructionARM64::EvaluateInstruction()` and `EmulateInstructionPPC64::EvaluateInstruction()`. This patch removes the redundant inner check.

The issue was found using `clang-tidy` check under review `misc-redundant-condition`. See https://reviews.llvm.org/D81272.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82558

Files:
  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
  lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
  lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp


Index: lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
===================================================================
--- lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
+++ lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
@@ -198,7 +198,7 @@
     if (!success)
       return false;
 
-    if (auto_advance_pc && (new_pc_value == orig_pc_value)) {
+    if (new_pc_value == orig_pc_value) {
       EmulateInstruction::Context context;
       context.type = eContextAdvancePC;
       context.SetNoArgs();
Index: lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
===================================================================
--- lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
+++ lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
@@ -433,7 +433,7 @@
     if (!success)
       return false;
 
-    if (auto_advance_pc && (new_pc_value == orig_pc_value)) {
+    if (new_pc_value == orig_pc_value) {
       EmulateInstruction::Context context;
       context.type = eContextAdvancePC;
       context.SetNoArgs();
Index: lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
===================================================================
--- lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
+++ lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
@@ -14361,7 +14361,7 @@
     if (!success)
       return false;
 
-    if (auto_advance_pc && (after_pc_value == orig_pc_value)) {
+    if (after_pc_value == orig_pc_value) {
       after_pc_value += m_opcode.GetByteSize();
 
       EmulateInstruction::Context context;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82558.273361.patch
Type: text/x-patch
Size: 1661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200625/ec2e5efc/attachment.bin>


More information about the lldb-commits mailing list