- Here we allocate buffers to hold the contents of unsaved files.
- The RemappedFiles vector is then passed to ASTUnit::LoadFromCommandLine() as an ArrayRef, here
- In ASTUnit::LoadFromCommandLine() we try to make a compiler invocation and exit early if that fails.
- If we did exit early from that function, both Unit and UnitErr are nullptr, making the function exit without ever cleaning up the memory allocations from step 1.
- The function allocating all those RemappedFile objects is not actually the same as the one deallocating, in the happy case.
1.1. I did not figure out where exactly does it get deleted, because the above seems to be enough data for now.
- My attempted solution is to iterate over remapped files and deallocate in this block, but it seems odd to deallocate through ArrayRef.