[PATCH] D155006: [YAML][NFC] Use BumpPtrAllocator instead of unique_ptrs

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 12:51:21 PDT 2023


Amir added a comment.

In D155006#4573881 <https://reviews.llvm.org/D155006#4573881>, @dblaikie wrote:

> What are the codepaths that currently destroy these nodes?

>From what I can tell there are just two: destructor of Input class and reassignment of TopNode in setCurrentDocument.

> Is there any mutability in the data structure, or is it only "build build build, use, then destroy"? If it's the latter, then yeah, arena allocation seems fine.

I didn't observe any mutability, it's the latter.

>> It's possible to match unique_ptr behavior and also free memory in setCurrentDocument.
>
> Ah, so perhaps this answers my question - the deallocation is done at `TopNode = `? *nod* Wuold probably be good to match the behavior there, to avoid continuous growth.

Will do.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155006



More information about the llvm-commits mailing list