[Lldb-commits] [lldb] [LLDB] Remove the redundent increment of 'properties' variable (PR #95675)
via lldb-commits
lldb-commits at lists.llvm.org
Sat Jun 15 11:07:57 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Shivam Gupta (xgupta)
<details>
<summary>Changes</summary>
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'.
---
Full diff: https://github.com/llvm/llvm-project/pull/95675.diff
1 Files Affected:
- (modified) lldb/source/Commands/CommandObjectTarget.cpp (+1-1)
``````````diff
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++;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/95675
More information about the lldb-commits
mailing list