[llvm] r297116 - Use LLVM for all stat-related functionality.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 19:43:19 PST 2017


Author: zturner
Date: Mon Mar  6 21:43:17 2017
New Revision: 297116

URL: http://llvm.org/viewvc/llvm-project?rev=297116&view=rev
Log:
Use LLVM for all stat-related functionality.

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

Modified:
    llvm/trunk/include/llvm/Support/FileSystem.h
    llvm/trunk/lib/Support/Path.cpp

Modified: llvm/trunk/include/llvm/Support/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=297116&r1=297115&r2=297116&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)
+++ llvm/trunk/include/llvm/Support/FileSystem.h Mon Mar  6 21:43:17 2017
@@ -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?

Modified: llvm/trunk/lib/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=297116&r1=297115&r2=297116&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Path.cpp (original)
+++ llvm/trunk/lib/Support/Path.cpp Mon Mar  6 21:43:17 2017
@@ -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;
 }




More information about the llvm-commits mailing list