[PATCH] D41594: Support `ivfsoverlay` option in Tooling

Vladimir Plyashkun via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 28 02:29:43 PST 2017


vladimir.plyashkun added inline comments.


================
Comment at: lib/Tooling/Tooling.cpp:287
+  if (Files->getVirtualFileSystem() != VirtualFileSystem) {
+    Files = new FileManager(Invocation->getFileSystemOpts(), VirtualFileSystem);
+  }
----------------
ilya-biryukov wrote:
> `Files` is a raw pointer, so we're leaking memory here.
> 
Agree.
I can try to replace type of this field to `llvm::IntrusiveRefCntPtr<T>`  instead of raw pointer.
But if i understand correctly, this class is available during whole execution, so memory will be freed on exit. 
I saw some other usages, for example, `createFileManager` method in the `CompilerInstance` also just reassign value to raw pointer.
https://clang.llvm.org/doxygen/classclang_1_1CompilerInstance.html#abeb2bbf46a8de987c227125a84935802


Repository:
  rC Clang

https://reviews.llvm.org/D41594





More information about the cfe-commits mailing list