[PATCH] D126401: [ADT] Explicitly delete copy/move constructors and operator= in IntervalMap
Krzysztof Parzyszek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 25 11:24:22 PDT 2022
kparzysz created this revision.
kparzysz added a reviewer: dblaikie.
Herald added a project: All.
kparzysz requested review of this revision.
Herald added a project: LLVM.
The default ones may do the wrong thing, for example perform a shallow copy instead of a deep copy. Disable them so they don't get accidentally used.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126401
Files:
llvm/include/llvm/ADT/IntervalMap.h
Index: llvm/include/llvm/ADT/IntervalMap.h
===================================================================
--- llvm/include/llvm/ADT/IntervalMap.h
+++ llvm/include/llvm/ADT/IntervalMap.h
@@ -1042,6 +1042,13 @@
new(&rootLeaf()) RootLeaf();
}
+ // Delete copy/move constructors and assignment operators because the
+ // default ones may not do the right thing (e.g. deep vs. shallow copy).
+ IntervalMap(const IntervalMap &Other) = delete;
+ IntervalMap(IntervalMap &&Other) = delete;
+ IntervalMap &operator=(const IntervalMap &Other) = delete;
+ IntervalMap &operator=(IntervalMap &&Other) = delete;
+
~IntervalMap() {
clear();
rootLeaf().~RootLeaf();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126401.432056.patch
Type: text/x-patch
Size: 685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220525/e14bef69/attachment.bin>
More information about the llvm-commits
mailing list