Revert "Use LLVM for all stat-related functionality."

this reverts r297116 because it breaks the unittests and
TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but
the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat
functionality is not a drop-in replacement for lldb's. The former is
based on stat(2) (which does symlink resolution), while the latter is
based on lstat(2) (which does not).

This also reverts subsequent build fixes (r297128, r297120, 297117) and
r297119 (Remove FileSpec dependency on FileSystem) which builds on top
of this.

llvm-svn: 297139
This commit is contained in:
Pavel Labath
2017-03-07 13:19:15 +00:00
parent 3d0af578cc
commit 30e6cbfcfc
38 changed files with 289 additions and 261 deletions

View File

@@ -16,7 +16,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Utility/Stream.h"
#include "llvm/Support/FileSystem.h"
using namespace lldb_private;
using namespace std;
@@ -151,23 +150,32 @@ size_t FileSpecList::GetFilesMatchingPartialPath(const char *path,
FileSpecList &matches) {
#if 0 // FIXME: Just sketching...
matches.Clear();
using namespace llvm::sys::fs;
file_status stats;
if (status(path, stats))
return 0;
if (exists(stats)) {
if (stats.type() == file_type::symlink_file) {
// Shouldn't there be a method that realpath's a file?
}
if (is_regular_file(stats) || (is_directory(stats) && dir_okay)) {
matches.Append(FileSpec(path));
return 1;
} else if (is_directory(stats)) {
// Fill the match list with all the files in the directory:
} else {
return 0;
}
} else {
FileSpec path_spec = FileSpec (path);
if (path_spec.Exists ())
{
FileSpec::FileType type = path_spec.GetFileType();
if (type == FileSpec::eFileTypeSymbolicLink)
// Shouldn't there be a Resolve on a file spec that real-path's it?
{
}
if (type == FileSpec::eFileTypeRegular
|| (type == FileSpec::eFileTypeDirectory && dir_okay))
{
matches.Append (path_spec);
return 1;
}
else if (type == FileSpec::eFileTypeDirectory)
{
// Fill the match list with all the files in the directory:
}
else
{
return 0;
}
}
else
{
ConstString dir_name = path_spec.GetDirectory();
ConstString file_name = GetFilename();
if (dir_name == nullptr)