diff options
author | Zachary Turner <zturner@google.com> | 2017-03-08 22:49:32 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-03-08 22:49:32 +0000 |
commit | 260bda3fbcb216143e10840163a9f93223770a27 (patch) | |
tree | 811dbe1925c56b51d9fc70aeb4f8749508de2689 /llvm/lib/Support/Path.cpp | |
parent | 5616adf65552eea6988b23ba266baf432209cac4 (diff) | |
download | bcm5719-llvm-260bda3fbcb216143e10840163a9f93223770a27.tar.gz bcm5719-llvm-260bda3fbcb216143e10840163a9f93223770a27.zip |
[Support] Add llvm::sys::fs::remove_directories.
We already have a function create_directories() which can create
an entire tree, and remove() which can remove an empty directory,
but we do not have remove_directories() which can remove an entire
tree. This patch adds such a function.
Because removing a directory tree can have dangerous consequences
when the tree contains a directory symlink, the patch here updates
the existing directory_iterator construct to optionally not follow
symlinks (previously it would always follow symlinks). The delete
algorithm uses this flag so that for symlinks, only the links are
removed, and not the targets.
On Windows this is implemented with SHFileOperation, which also
does not recurse into symbolic links or junctions.
Differential Revision: https://reviews.llvm.org/D30676
llvm-svn: 297314
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r-- | llvm/lib/Support/Path.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index 11fa3c3e1a6..fc3cf525c93 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -1189,7 +1189,7 @@ std::error_code identify_magic(const Twine &Path, file_magic &Result) { } std::error_code directory_entry::status(file_status &result) const { - return fs::status(Path, result); + return fs::status(Path, result, FollowSymlinks); } } // end namespace fs |