[llvm] [MC] Add MCFragment allocation helpers (PR #95197)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 10:26:15 PDT 2024
================
@@ -90,6 +90,12 @@ class MCObjectStreamer : public MCStreamer {
MCFragment *getCurrentFragment() const;
+ template <typename F, typename... Args> F *allocAndAdd(Args &&...args) {
+ F *Frag = new F(std::forward<Args>(args)...);
----------------
aengelke wrote:
Hmm. What was the reason to put allocation inside the streamer? My thinking was to keep allocation in MCContext (maybe without merging allocation and adding), because it already manages all other resources, and then all fragments can go to the same allocator. Mixing bump ptr allocator and operator new raises the question makes it more difficult to decide how to free a fragment.
https://github.com/llvm/llvm-project/pull/95197
More information about the llvm-commits
mailing list