[Lldb-commits] [lldb] 558315a - [LLDB] Remove the redundent 'properties' variable (#95675)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 26 18:35:47 PDT 2024


Author: Shivam Gupta
Date: 2024-07-27T07:05:44+05:30
New Revision: 558315a0ea8cae8613c3a0061bc6cbe50c5b392f

URL: https://github.com/llvm/llvm-project/commit/558315a0ea8cae8613c3a0061bc6cbe50c5b392f
DIFF: https://github.com/llvm/llvm-project/commit/558315a0ea8cae8613c3a0061bc6cbe50c5b392f.diff

LOG: [LLDB] Remove the redundent 'properties' variable (#95675)

This is described in (N3) https://pvs-studio.com/en/blog/posts/cpp/1126/

Warning message -
V547 Expression 'properties ++ > 0' is always false.
CommandObjectTarget.cpp:100

I could not understand it properly but the properties++ operation is
performed twice when the target architecture is valid.
First increment seems unnecessary since it is always false '0>0'.

---------

Co-authored-by: xgupta <shivma98.tkg at gmail.com>

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectTarget.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index cc381a2ecee1d..eb57f37ae1baa 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -97,7 +97,7 @@ static void DumpTargetInfo(uint32_t target_idx, Target *target,
 
   uint32_t properties = 0;
   if (target_arch.IsValid()) {
-    strm.Printf("%sarch=", properties++ > 0 ? ", " : " ( ");
+    strm.Printf(" ( arch=");
     target_arch.DumpTriple(strm.AsRawOstream());
     properties++;
   }


        


More information about the lldb-commits mailing list