This is an archive of the discontinued LLVM Phabricator instance.

Add convenience method in FileSystem to check if a path/filespec is a directory.
ClosedPublic

Authored by JDevlieghere on Nov 5 2018, 6:48 PM.

Details

Summary

Replace calls to LLVM's is_directory with calls to LLDB's FileSytem class. For this I introduced a new convenience method that, like the other methods, takes either a path or filespec.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Nov 5 2018, 6:48 PM

Why? We already put a lot of effort into reusing code from LLVM.

Why? We already put a lot of effort into reusing code from LLVM.

This is still using code from LLVM, the FileSystem class is just an abstraction in between:

  1. It uses LLVM's virtual file system. The VFS is stateful and the FileSystem class maintains this state. If you don't specify a virtual file system it uses the "real" file system (the default).
  2. It has convenience methods for FileSpecs, so that you don't have to convert them at every call site. These functions used to be methods in the FileSpec class, something we wanted to get rid of for a while because conceptually the latter is just a "smart path".

I started doing all this work to support reproducers in LLDB. We'll need a bunch of files that won't live at their original location and the VFS makes it possible to deal with that transparently.

davide accepted this revision.Nov 7 2018, 3:29 PM
This revision is now accepted and ready to land.Nov 7 2018, 3:29 PM
This revision was automatically updated to reflect the committed changes.