[PATCH] D125899: [ADT] Add copy constructor to IntervalMap
Krzysztof Parzyszek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 18 09:07:13 PDT 2022
kparzysz created this revision.
kparzysz added reviewers: dblaikie, dim, brooks.
Herald added subscribers: krytarowski, arichardson, emaste.
Herald added a project: All.
kparzysz requested review of this revision.
Herald added a project: LLVM.
`IntervalMap` has a union with a member of type `RootLeaf`, and `RootLeaf` contains an array of `std::pair`. On FreeBSD 13- `std::pair` has a non-trivial copy constructor, which causes the implicitly declared copy constructor for `IntervalMap` to be deleted. As a result, code that attempts to copy construct an `IntervalMap` fails to compile.
For more information see https://reviews.llvm.org/rG0d8cb8b399ad, and https://reviews.llvm.org/D125611.
This fixes https://github.com/llvm/llvm-project/issues/55414.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125899
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,16 @@
new(&rootLeaf()) RootLeaf();
}
+ IntervalMap(const IntervalMap &Other)
+ : height(Other.height), rootSize(Other.rootSize),
+ allocator(Other.allocator) {
+ if (Other.branched()) {
+ new (&rootBranchData()) RootBranchData(Other.rootBranchData());
+ } else {
+ new (&rootLeaf()) RootLeaf(Other.rootLeaf());
+ }
+ }
+
~IntervalMap() {
clear();
rootLeaf().~RootLeaf();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125899.430403.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220518/99266d98/attachment.bin>
More information about the llvm-commits
mailing list