diff options
author | Zachary Turner <zturner@google.com> | 2017-03-07 03:43:17 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-03-07 03:43:17 +0000 |
commit | 990e3cd8e25970e477840d81972290858caffd50 (patch) | |
tree | 50278a2ce428ac02066aa7611cbe42cc89b11e6e /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | |
parent | 06ec03c2110e1a17271699a95ba28b0a56d9e17b (diff) | |
download | bcm5719-llvm-990e3cd8e25970e477840d81972290858caffd50.tar.gz bcm5719-llvm-990e3cd8e25970e477840d81972290858caffd50.zip |
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
llvm-svn: 297116
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index fdc13fbc8ac..a34c9b89227 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -51,6 +51,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/FileSystem.h" using namespace lldb; using namespace lldb_private; @@ -2575,9 +2576,13 @@ bool ScriptInterpreterPython::LoadScriptingModule( Locker::NoSTDIN, Locker::FreeAcquiredLock | (init_session ? Locker::TearDownSession : 0)); + namespace fs = llvm::sys::fs; + fs::file_status st; + std::error_code ec = status(target_file.GetPath(), st); - if (target_file.GetFileType() == FileSpec::eFileTypeInvalid || - target_file.GetFileType() == FileSpec::eFileTypeUnknown) { + if (ec || st.type() == fs::file_type::status_error || + st.type() == fs::file_type::type_unknown || + st.type() == fs::file_type::file_not_found) { // if not a valid file of any sort, check if it might be a filename still // dot can't be used but / and \ can, and if either is found, reject if (strchr(pathname, '\\') || strchr(pathname, '/')) { @@ -2586,9 +2591,8 @@ bool ScriptInterpreterPython::LoadScriptingModule( } basename = pathname; // not a filename, probably a package of some sort, // let it go through - } else if (target_file.GetFileType() == FileSpec::eFileTypeDirectory || - target_file.GetFileType() == FileSpec::eFileTypeRegular || - target_file.GetFileType() == FileSpec::eFileTypeSymbolicLink) { + } else if (is_directory(st) || fs::is_regular_file(st) || + st.type() == fs::file_type::symlink_file) { std::string directory = target_file.GetDirectory().GetCString(); replace_all(directory, "\\", "\\\\"); replace_all(directory, "'", "\\'"); |