diff options
author | Zachary Turner <zturner@google.com> | 2017-05-12 04:51:55 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-05-12 04:51:55 +0000 |
commit | 97206d572797bddc1bba71bb1c18c97f19d69053 (patch) | |
tree | fdf21d24485672cf97c800264d135b9d5d2ecdce /lldb/source/Target/ModuleCache.cpp | |
parent | 3086b45a2fae833e8419885e78c598d936cc6429 (diff) | |
download | bcm5719-llvm-97206d572797bddc1bba71bb1c18c97f19d69053.tar.gz bcm5719-llvm-97206d572797bddc1bba71bb1c18c97f19d69053.zip |
Rename Error -> Status.
This renames the LLDB error class to Status, as discussed
on the lldb-dev mailing list.
A change of this magnitude cannot easily be done without
find and replace, but that has potential to catch unwanted
occurrences of common strings such as "Error". Every effort
was made to find all the obvious things such as the word "Error"
appearing in a string, etc, but it's possible there are still
some lingering occurences left around. Hopefully nothing too
serious.
llvm-svn: 302872
Diffstat (limited to 'lldb/source/Target/ModuleCache.cpp')
-rw-r--r-- | lldb/source/Target/ModuleCache.cpp | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp index a4aa26a0e48..2b654772639 100644 --- a/lldb/source/Target/ModuleCache.cpp +++ b/lldb/source/Target/ModuleCache.cpp @@ -54,7 +54,7 @@ private: FileSpec m_file_spec; public: - ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid, Error &error); + ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid, Status &error); void Delete(); }; @@ -64,7 +64,7 @@ static FileSpec JoinPath(const FileSpec &path1, const char *path2) { return result_spec; } -static Error MakeDirectory(const FileSpec &dir_path) { +static Status MakeDirectory(const FileSpec &dir_path) { namespace fs = llvm::sys::fs; return fs::create_directories(dir_path.GetPath(), true, fs::perms::owner_all); @@ -92,7 +92,7 @@ void DeleteExistingModule(const FileSpec &root_dir_spec, if (!module_uuid.IsValid()) return; - Error error; + Status error; ModuleLock lock(root_dir_spec, module_uuid, error); if (error.Fail()) { if (log) @@ -125,17 +125,17 @@ void DecrementRefExistingModule(const FileSpec &root_dir_spec, llvm::sys::fs::remove(symfile_spec.GetPath()); } -Error CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, - const char *hostname, - const FileSpec &platform_module_spec, - const FileSpec &local_module_spec, - bool delete_existing) { +Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, + const char *hostname, + const FileSpec &platform_module_spec, + const FileSpec &local_module_spec, + bool delete_existing) { const auto sysroot_module_path_spec = JoinPath(JoinPath(root_dir_spec, hostname), platform_module_spec.GetPath().c_str()); if (sysroot_module_path_spec.Exists()) { if (!delete_existing) - return Error(); + return Status(); DecrementRefExistingModule(root_dir_spec, sysroot_module_path_spec); } @@ -152,7 +152,7 @@ Error CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, } // namespace ModuleLock::ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid, - Error &error) { + Status &error) { const auto lock_dir_spec = JoinPath(root_dir_spec, kLockDirName); error = MakeDirectory(lock_dir_spec); if (error.Fail()) @@ -184,9 +184,9 @@ void ModuleLock::Delete() { ///////////////////////////////////////////////////////////////////////// -Error ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, - const ModuleSpec &module_spec, const FileSpec &tmp_file, - const FileSpec &target_file) { +Status ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, const FileSpec &tmp_file, + const FileSpec &target_file) { const auto module_spec_dir = GetModuleDirectory(root_dir_spec, module_spec.GetUUID()); const auto module_file_path = @@ -196,27 +196,27 @@ Error ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, const auto err_code = llvm::sys::fs::rename(tmp_file_path, module_file_path.GetPath()); if (err_code) - return Error("Failed to rename file %s to %s: %s", tmp_file_path.c_str(), - module_file_path.GetPath().c_str(), - err_code.message().c_str()); + return Status("Failed to rename file %s to %s: %s", tmp_file_path.c_str(), + module_file_path.GetPath().c_str(), + err_code.message().c_str()); const auto error = CreateHostSysRootModuleLink( root_dir_spec, hostname, target_file, module_file_path, true); if (error.Fail()) - return Error("Failed to create link to %s: %s", - module_file_path.GetPath().c_str(), error.AsCString()); - return Error(); + return Status("Failed to create link to %s: %s", + module_file_path.GetPath().c_str(), error.AsCString()); + return Status(); } -Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, - const ModuleSpec &module_spec, - ModuleSP &cached_module_sp, bool *did_create_ptr) { +Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, + ModuleSP &cached_module_sp, bool *did_create_ptr) { const auto find_it = m_loaded_modules.find(module_spec.GetUUID().GetAsString()); if (find_it != m_loaded_modules.end()) { cached_module_sp = (*find_it).second.lock(); if (cached_module_sp) - return Error(); + return Status(); m_loaded_modules.erase(find_it); } @@ -226,10 +226,10 @@ Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, module_spec_dir, module_spec.GetFileSpec().GetFilename().AsCString()); if (!module_file_path.Exists()) - return Error("Module %s not found", module_file_path.GetPath().c_str()); + return Status("Module %s not found", module_file_path.GetPath().c_str()); if (module_file_path.GetByteSize() != module_spec.GetObjectSize()) - return Error("Module %s has invalid file size", - module_file_path.GetPath().c_str()); + return Status("Module %s has invalid file size", + module_file_path.GetPath().c_str()); // We may have already cached module but downloaded from an another host - in // this case let's create a link to it. @@ -237,8 +237,8 @@ Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, module_spec.GetFileSpec(), module_file_path, false); if (error.Fail()) - return Error("Failed to create link to %s: %s", - module_file_path.GetPath().c_str(), error.AsCString()); + return Status("Failed to create link to %s: %s", + module_file_path.GetPath().c_str(), error.AsCString()); auto cached_module_spec(module_spec); cached_module_spec.GetUUID().Clear(); // Clear UUID since it may contain md5 @@ -258,16 +258,16 @@ Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, m_loaded_modules.insert( std::make_pair(module_spec.GetUUID().GetAsString(), cached_module_sp)); - return Error(); + return Status(); } -Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, - const char *hostname, - const ModuleSpec &module_spec, - const ModuleDownloader &module_downloader, - const SymfileDownloader &symfile_downloader, - lldb::ModuleSP &cached_module_sp, - bool *did_create_ptr) { +Status ModuleCache::GetAndPut(const FileSpec &root_dir_spec, + const char *hostname, + const ModuleSpec &module_spec, + const ModuleDownloader &module_downloader, + const SymfileDownloader &symfile_downloader, + lldb::ModuleSP &cached_module_sp, + bool *did_create_ptr) { const auto module_spec_dir = GetModuleDirectory(root_dir_spec, module_spec.GetUUID()); auto error = MakeDirectory(module_spec_dir); @@ -276,9 +276,9 @@ Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, ModuleLock lock(root_dir_spec, module_spec.GetUUID(), error); if (error.Fail()) - return Error("Failed to lock module %s: %s", - module_spec.GetUUID().GetAsString().c_str(), - error.AsCString()); + return Status("Failed to lock module %s: %s", + module_spec.GetUUID().GetAsString().c_str(), + error.AsCString()); const auto escaped_hostname(GetEscapedHostname(hostname)); // Check local cache for a module. @@ -291,13 +291,13 @@ Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, error = module_downloader(module_spec, tmp_download_file_spec); llvm::FileRemover tmp_file_remover(tmp_download_file_spec.GetPath()); if (error.Fail()) - return Error("Failed to download module: %s", error.AsCString()); + return Status("Failed to download module: %s", error.AsCString()); // Put downloaded file into local module cache. error = Put(root_dir_spec, escaped_hostname.c_str(), module_spec, tmp_download_file_spec, module_spec.GetFileSpec()); if (error.Fail()) - return Error("Failed to put module into cache: %s", error.AsCString()); + return Status("Failed to put module into cache: %s", error.AsCString()); tmp_file_remover.releaseFile(); error = Get(root_dir_spec, escaped_hostname.c_str(), module_spec, @@ -315,17 +315,18 @@ Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, // module might // contain the necessary symbols and the debugging is also possible without // a symfile. - return Error(); + return Status(); error = Put(root_dir_spec, escaped_hostname.c_str(), module_spec, tmp_download_sym_file_spec, GetSymbolFileSpec(module_spec.GetFileSpec())); if (error.Fail()) - return Error("Failed to put symbol file into cache: %s", error.AsCString()); + return Status("Failed to put symbol file into cache: %s", + error.AsCString()); tmp_symfile_remover.releaseFile(); FileSpec symfile_spec = GetSymbolFileSpec(cached_module_sp->GetFileSpec()); cached_module_sp->SetSymbolFileFileSpec(symfile_spec); - return Error(); + return Status(); } |