OSDN Git Service

Use LLVM for all stat-related functionality.
authorZachary Turner <zturner@google.com>
Tue, 7 Mar 2017 03:43:17 +0000 (03:43 +0000)
committerZachary Turner <zturner@google.com>
Tue, 7 Mar 2017 03:43:17 +0000 (03:43 +0000)
This deletes LLDB's FileType enumeration and replaces all
users, and all calls to functions that check whether a file
exists etc with corresponding calls to LLVM.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297116 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/FileSystem.h
lib/Support/Path.cpp

index f2a17b6..0fbec08 100644 (file)
@@ -483,6 +483,12 @@ inline bool is_local(int FD) {
 ///
 /// @param status A file_status previously returned from status.
 /// @returns status.type() == file_type::directory_file.
+file_type get_file_type(const Twine &Path);
+
+/// @brief Does status represent a directory?
+///
+/// @param status A file_status previously returned from status.
+/// @returns status.type() == file_type::directory_file.
 bool is_directory(file_status status);
 
 /// @brief Is path a directory?
index 0709ec2..94ed187 100644 (file)
@@ -953,6 +953,13 @@ bool status_known(file_status s) {
   return s.type() != file_type::status_error;
 }
 
+file_type get_file_type(const Twine &Path) {
+  file_status st;
+  if (status(Path, st))
+    return file_type::status_error;
+  return st.type();
+}
+
 bool is_directory(file_status status) {
   return status.type() == file_type::directory_file;
 }