[clang] [Clang] Fix a variable shadowing in MapLattice (NFC) (PR #95697)
Shivam Gupta via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 16 03:13:36 PDT 2024
https://github.com/xgupta updated https://github.com/llvm/llvm-project/pull/95697
>From 60fdd988d16ea624d2fd732cf03ee0fc69a14abc Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivam98.tkg at gmail.com>
Date: Sun, 16 Jun 2024 15:41:09 +0530
Subject: [PATCH 1/2] [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(); }
>From bfa6cae6b4e01a7fb5fd599dc69a8a1ffa597878 Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivam98.tkg at gmail.com>
Date: Sun, 16 Jun 2024 15:42:53 +0530
Subject: [PATCH 2/2] clang-format
---
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 9d7afbe6ae7bf..b2d147e4ae444 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(); }
More information about the cfe-commits
mailing list