diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-10 20:36:42 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-10 20:36:42 +0000 |
commit | 78dcc03c3791097ebefa7590269329abe616b26d (patch) | |
tree | b296216520a8dafe30cc72e21b25e3aa523f2e19 /llvm/lib/Support/Path.cpp | |
parent | bccb4fdd059e99c4c14d50d643aea022e285c4cf (diff) | |
download | bcm5719-llvm-78dcc03c3791097ebefa7590269329abe616b26d.tar.gz bcm5719-llvm-78dcc03c3791097ebefa7590269329abe616b26d.zip |
Remove remove_all. A compiler has no need for recursively deleting a directory.
llvm-svn: 198955
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r-- | llvm/lib/Support/Path.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index c869b30a8e2..b97b7a4baf2 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -983,45 +983,6 @@ error_code identify_magic(const Twine &path, file_magic &result) { return error_code::success(); } -namespace { -error_code remove_all_r(StringRef path, file_type ft, uint32_t &count) { - if (ft == file_type::directory_file) { - // This code would be a lot better with exceptions ;/. - error_code ec; - directory_iterator i(path, ec); - if (ec) return ec; - for (directory_iterator e; i != e; i.increment(ec)) { - if (ec) return ec; - file_status st; - if (error_code ec = i->status(st)) return ec; - if (error_code ec = remove_all_r(i->path(), st.type(), count)) return ec; - } - bool obviously_this_exists; - if (error_code ec = remove(path, obviously_this_exists)) return ec; - assert(obviously_this_exists); - ++count; // Include the directory itself in the items removed. - } else { - bool obviously_this_exists; - if (error_code ec = remove(path, obviously_this_exists)) return ec; - assert(obviously_this_exists); - ++count; - } - - return error_code::success(); -} -} // end unnamed namespace - -error_code remove_all(const Twine &path, uint32_t &num_removed) { - SmallString<128> path_storage; - StringRef p = path.toStringRef(path_storage); - - file_status fs; - if (error_code ec = status(path, fs)) - return ec; - num_removed = 0; - return remove_all_r(p, fs.type(), num_removed); -} - error_code directory_entry::status(file_status &result) const { return fs::status(Path, result); } |