[FileCollector] add support for recording empty directories
authorAlex Lorenz <arphaman@gmail.com>
Thu, 25 Jul 2019 21:47:11 +0000 (21:47 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Thu, 25 Jul 2019 21:47:11 +0000 (21:47 +0000)
commitb680422ef809942767cb0bfec4f00af197c3d2c4
treec15e73df95b01fa4e50f2e928b665edb59dd7d89
parente54dc6b8b58d7b94c2737adb941c25fea54b6a70
[FileCollector] add support for recording empty directories

The file collector class is useful for constructing reproducers by
creating a snapshot of the files that are accessed. Sometimes it might
also be important to construct directories that don't necessarily have files,
but are still accessed by some tool that we want to make a reproducer for.
This is useful for instance for modeling the behavior of Clang's header search,
which scans through a number of directories it doesn't actually access when
looking for framework headers. This commit extends the file collector to allow
it to work with paths that are just directories, by constructing them as the
files are copied over.

Differential Revision: https://reviews.llvm.org/D65297

llvm-svn: 367061
llvm/lib/Support/FileCollector.cpp
llvm/unittests/Support/FileCollectorTest.cpp