-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang] Fix a variable shadowing in MapLattice (NFC) #95697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-analysis Author: Shivam Gupta (xgupta) ChangesReported in https://pvs-studio.com/en/blog/posts/cpp/1126/, fragment N10. The PVS-Studio warning: Full diff: https://github.com/llvm/llvm-project/pull/95697.diff 1 Files Affected:
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(); }
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, how can this ever have worked? Appears that the answer is that there simply aren't any existing callers of this constructor...
In any case, thanks for the fix!
Thanks for the review @martinboehme! |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/2624 Here is the relevant piece of the build log for the reference:
|
Summary: 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 Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250526
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