[cfe-dev] FileManager re-factor
John Kelley
jekelley at apple.com
Sun Dec 7 18:11:17 PST 2008
I've been looking at how FileManager is used in clang to figure out
how best to use llvm::sys::PathWithStatus to replace large parts of
FileEntry and it seems possibly all of DirectoryEntry.
I was hoping that I could get rid of the (per-file) directory stat by
assuming that if the file existed, so does the directory but then I
saw that we use the directory device and inode on unix-like systems as
an index in UniqueDirContainer. Is the stat more expensive then
hitting an llvm::StringMap to see if we've checked this exact
directory yet? We seem to use the device/inode combo to account for
sym-linked directories but we don't seem to try to resolve the
symlinked directory to it's origin so as to avoid the FS stat on open.
Is this something that should be implemented instead?
Also, the directory stat can be ifdef'd out for WIN32 as the WIN32
implementation of UniqueDirContainer doesn't make use of any of the
stat elements.
I've already ben able to replace the path construction and parsing
code in FileManager with calls to the appropriate Path member function
which cleans things up nicely.
Thoughts?
John
More information about the cfe-dev
mailing list