[PATCH] D125899: [ADT] Add copy constructor to IntervalMap

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 18 10:00:06 PDT 2022


kparzysz updated this revision to Diff 430429.
kparzysz added a comment.

Changed the copy to a deep one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125899/new/

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,11 @@
     new(&rootLeaf()) RootLeaf();
   }
 
+  IntervalMap(const IntervalMap &Other) : IntervalMap(Other.allocator) {
+    for (auto i = Other.begin(), e = Other.end(); i != e; ++i)
+      insert(i.start(), i.stop(), i.value());
+  }
+
   ~IntervalMap() {
     clear();
     rootLeaf().~RootLeaf();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125899.430429.patch
Type: text/x-patch
Size: 510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220518/0e5bc2ec/attachment.bin>


More information about the llvm-commits mailing list