[Lldb-commits] [lldb] [LLDB] Remove the redundent increment of 'properties' variable (PR #95675)
Shivam Gupta via lldb-commits
lldb-commits at lists.llvm.org
Sat Jun 15 11:07:23 PDT 2024
https://github.com/xgupta created https://github.com/llvm/llvm-project/pull/95675
This is described in (N3) https://pvs-studio.com/en/blog/posts/cpp/1126/ so caught by the PVS Studio analyzer. 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'.
>From a305b3958b3bf5551fda2d17af8eb11b9d122125 Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivam98.tkg at gmail.com>
Date: Sat, 15 Jun 2024 23:12:19 +0530
Subject: [PATCH] [LLDB] Remove the redundent increment of 'properties'
variable
This is described in (N3) https://pvs-studio.com/en/blog/posts/cpp/1126/ so caught by the PVS Studio analyzer.
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'.
---
lldb/source/Commands/CommandObjectTarget.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index ae6c6d5479a19..c3d4307267a1b 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("%sarch=", properties > 0 ? ", " : " ( ");
target_arch.DumpTriple(strm.AsRawOstream());
properties++;
}
More information about the lldb-commits
mailing list