[Lldb-commits] [PATCH] D30807: Use LLVM's directory enumeration code

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 9 20:26:13 PST 2017


zturner created this revision.

`FileSpec::EnumerateDirectory` has a bunch of platform-specific gunk in it for posix and non-posix platforms.  We can get rid of all this by using LLVM's easy-to-use directory iterators.

Ideally I would like to just remove this entire `EnumerateDirectory` function.  It served a useful purpose when the code for iterating directories would have to be re-invented every single time otherwise, but since we have these nice iterators, this intermediate enumerator function actually makes the code more verbose, since we have to set up this baton and return these magic values from the callback function, when usually this just means "be recursive" or "don't be recursive", something the writer of the algorithm could more cleanly express by simply choosing `recursive_directory_iterator` or `directory_iterator`.  Anyway, I'm getting ahead of myself.  For now just clean up this function and leave everything else as-is.


https://reviews.llvm.org/D30807

Files:
  lldb/include/lldb/Host/FileSpec.h
  lldb/source/Host/common/FileSpec.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30807.91260.patch
Type: text/x-patch
Size: 13247 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170310/b2567cde/attachment-0001.bin>


More information about the lldb-commits mailing list