[PATCH] D120486: [objcopy] Refactor CommonConfig to add posibility to specify added/updated sections as MemoryBuffer.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 25 02:38:39 PST 2022


avl added inline comments.


================
Comment at: llvm/include/llvm/ObjCopy/CommonConfig.h:199
+  StringRef SectionName;
+  std::shared_ptr<MemoryBuffer> SectionData;
+};
----------------
jhenderson wrote:
> Why `shared_ptr`?
There are many cases where CommonConfig and ConfigManager are copied using "copy" semantic. unique_ptr should be copied with "move" semantic. if unique_ptr would be used here then we need to write strange copy operator:


```
NewSectionInfo& operator=(const NewSectionInfo& Other) {
   SectionData = std::move(const_cast<NewSectionInfo*>(&Other)->SectionData);
}
```




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120486



More information about the llvm-commits mailing list