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
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index 9e277db..10c1a24 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -33,7 +33,6 @@
 #include "lldb/Utility/CleanUp.h"
 
 #include "llvm/ADT/SmallString.h"
-#include "llvm/Support/FileSystem.h"
 
 using namespace lldb_private;
 
@@ -110,7 +109,7 @@
 } DiskFilesOrDirectoriesBaton;
 
 FileSpec::EnumerateDirectoryResult
-DiskFilesOrDirectoriesCallback(void *baton, llvm::sys::fs::file_type file_type,
+DiskFilesOrDirectoriesCallback(void *baton, FileSpec::FileType file_type,
                                const FileSpec &spec) {
   const char *name = spec.GetFilename().AsCString();
 
@@ -139,10 +138,10 @@
     strcpy(end_ptr, name);
 
     bool isa_directory = false;
-    if (file_type == llvm::sys::fs::file_type::directory_file)
+    if (file_type == FileSpec::eFileTypeDirectory)
       isa_directory = true;
-    else if (file_type == llvm::sys::fs::file_type::symlink_file) {
-      if (llvm::sys::fs::is_directory(partial_name_copy))
+    else if (file_type == FileSpec::eFileTypeSymbolicLink) {
+      if (FileSpec(partial_name_copy, false).IsDirectory())
         isa_directory = true;
     }
 
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index c8871c8..37dec18 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -50,8 +50,6 @@
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadSpec.h"
 
-#include "llvm/Support/FileSystem.h"
-
 // C Includes
 // C++ Includes
 #include <cerrno>
@@ -4138,21 +4136,20 @@
         module_sp->SetSymbolFileFileSpec(FileSpec());
       }
 
-      namespace fs = llvm::sys::fs;
       if (module_spec.GetUUID().IsValid()) {
         StreamString ss_symfile_uuid;
         module_spec.GetUUID().Dump(&ss_symfile_uuid);
         result.AppendErrorWithFormat(
             "symbol file '%s' (%s) does not match any existing module%s\n",
             symfile_path, ss_symfile_uuid.GetData(),
-            !fs::is_regular_file(symbol_fspec.GetPath())
+            (symbol_fspec.GetFileType() != FileSpec::eFileTypeRegular)
                 ? "\n       please specify the full path to the symbol file"
                 : "");
       } else {
         result.AppendErrorWithFormat(
             "symbol file '%s' does not match any existing module%s\n",
             symfile_path,
-            !fs::is_regular_file(symbol_fspec.GetPath())
+            (symbol_fspec.GetFileType() != FileSpec::eFileTypeRegular)
                 ? "\n       please specify the full path to the symbol file"
                 : "");
       }