https://github.com/xgupta created 
https://github.com/llvm/llvm-project/pull/95697

Reported in https://pvs-studio.com/en/blog/posts/cpp/1126/, fragment N10.

The PVS-Studio warning:
V570 The 'C' variable is assigned to itself. MapLattice.h:52

>From 60fdd988d16ea624d2fd732cf03ee0fc69a14abc Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivam98....@gmail.com>
Date: Sun, 16 Jun 2024 15:41:09 +0530
Subject: [PATCH] [Clang] Fix a variable shadowing in MapLattice (NFC)

Reported in https://pvs-studio.com/en/blog/posts/cpp/1126/, fragment N10.

The PVS-Studio warning:
V570 The 'C' variable is assigned to itself. MapLattice.h:52
---
 clang/include/clang/Analysis/FlowSensitive/MapLattice.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/Analysis/FlowSensitive/MapLattice.h 
b/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
index 16b0c978779a7..9d7afbe6ae7bf 100644
--- a/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
+++ b/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
@@ -49,7 +49,7 @@ template <typename Key, typename ElementLattice> class 
MapLattice {
 
   MapLattice() = default;
 
-  explicit MapLattice(Container C) { C = std::move(C); }
+  explicit MapLattice(Container C) : C { std::move(C) } {};
 
   // The `bottom` element is the empty map.
   static MapLattice bottom() { return MapLattice(); }

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to