This is an archive of the discontinued LLVM Phabricator instance.

Frontend: Remove CompilerInstance::VirtualFileSystem, NFC
ClosedPublic

Authored by dexonsmith on Mar 14 2019, 11:29 AM.

Details

Summary

Remove CompilerInstance::VirtualFileSystem and
CompilerInstance::setVirtualFileSystem, instead relying on the VFS in
the FileManager. CompilerInstance and its clients already went to some
trouble to make these match. Now they are guaranteed to match.

As part of this, I added a VFS parameter (defaults to nullptr) to
CompilerInstance::createFileManager to avoid repeating construction
logic in clients that just want to customize the VFS.

Diff Detail

Event Timeline

dexonsmith created this revision.Mar 14 2019, 11:29 AM

I slightly simplified the code for CompilerInstance::createFileManager (replaced with an assert), since I noticed that FileManager always constructs its own VFS if it isn't passed one.

... since I noticed that FileManager ...

This kind of implies that we should move the comment from FileManager constructor implementation to the header thus making it an explicit part of the interface contract.

// If the caller doesn't provide a virtual file system, just grab the real
// file system.

Maybe https://reviews.llvm.org/D59388 would be the right place to do it.

Document the default VFS used by the FileManager.

... since I noticed that FileManager ...

This kind of implies that we should move the comment from FileManager constructor implementation to the header thus making it an explicit part of the interface contract.

// If the caller doesn't provide a virtual file system, just grab the real
// file system.

Maybe https://reviews.llvm.org/D59388 would be the right place to do it.

Good call; since I'm relying on it in this patch I've updated this patch to document it.

jkorous accepted this revision.Mar 21 2019, 8:23 PM

LGTM

This revision is now accepted and ready to land.Mar 21 2019, 8:23 PM
dexonsmith closed this revision.Mar 26 2019, 3:17 PM

Committed r357037.