[clang] ca69444 - [Clang] Fix a variable shadowing in MapLattice (NFC) (#95697)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 04:03:09 PDT 2024


Author: Shivam Gupta
Date: 2024-07-25T16:33:05+05:30
New Revision: ca69444cef0858ad4facecbfc2232a02422aca9f

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

LOG: [Clang] Fix a variable shadowing in MapLattice (NFC) (#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

Added: 
    

Modified: 
    clang/include/clang/Analysis/FlowSensitive/MapLattice.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/FlowSensitive/MapLattice.h b/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
index 16b0c978779a7..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