This is an archive of the discontinued LLVM Phabricator instance.

VFS: Return new file systems as uniquely owned when possible, almost NFC
ClosedPublic

Authored by dexonsmith on Dec 8 2020, 3:01 PM.

Details

Summary

Uniformly return uniquely-owned filesystems from VFS creation APIs. The
one exception is getRealFileSystem, which has a single instance and
needs to be shared.

This is almost NFC, except that it fixes a memory leak in
vfs::collectVFSFromYAML().

Depends on https://reviews.llvm.org/D92888

Diff Detail

Event Timeline

dexonsmith created this revision.Dec 8 2020, 3:01 PM
dexonsmith requested review of this revision.Dec 8 2020, 3:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2020, 3:01 PM
JDevlieghere accepted this revision.Dec 8 2020, 4:04 PM

LGTM, thanks for cleaning that up!

This revision is now accepted and ready to land.Dec 8 2020, 4:04 PM
This revision was landed with ongoing or failed builds.Dec 8 2020, 5:52 PM
This revision was automatically updated to reflect the committed changes.

This is almost NFC, except that it fixes a memory leak in vfs::collectVFSFromYAML().

Was this memory leak identified by any of the LLVM/Clang sanitizers, or at least valgrind? (if it was identified by sanitizers I wonder why it persisted so long, given we have sanitizer bots folks like to keep green, etc)

This is almost NFC, except that it fixes a memory leak in vfs::collectVFSFromYAML().

Was this memory leak identified by any of the LLVM/Clang sanitizers, or at least valgrind? (if it was identified by sanitizers I wonder why it persisted so long, given we have sanitizer bots folks like to keep green, etc)

Not that I'm aware of, I just noticed it when I was in there. I'm not sure why -fsanitize=address never flagged this; I'd have thought in-tree clang tests using -ivfsoverlay would exercise this.