diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-03-28 00:34:09 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-03-28 00:34:09 +0000 |
| commit | fa3e8979a53217f19c06b7623a70ef58c902e4fb (patch) | |
| tree | 5c514be94a6f6bad8cce4b64cd268b0657e6b059 | |
| parent | ac8c17533f5dd20f31440d3f0ae253b9f6f50205 (diff) | |
| download | bcm5719-llvm-fa3e8979a53217f19c06b7623a70ef58c902e4fb.tar.gz bcm5719-llvm-fa3e8979a53217f19c06b7623a70ef58c902e4fb.zip | |
ELF: make code concise using "using".
llvm-svn: 233458
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp index 4d5c9a8046e..03332399e0a 100644 --- a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp +++ b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp @@ -25,6 +25,9 @@ #include <cxxabi.h> #endif +using llvm::sys::fs::exists; +using llvm::sys::path::is_absolute; + namespace lld { class CommandLineUndefinedAtom : public SimpleUndefinedAtom { @@ -122,7 +125,7 @@ ErrorOr<StringRef> ELFLinkingContext::searchLibrary(StringRef libName) const { llvm::sys::path::append(path, hasColonPrefix ? libName.drop_front() : Twine("lib", libName) + ".so"); - if (llvm::sys::fs::exists(path.str())) + if (exists(path.str())) return StringRef(*new (_allocator) std::string(path.str())); } // Search for static libraries too @@ -130,10 +133,10 @@ ErrorOr<StringRef> ELFLinkingContext::searchLibrary(StringRef libName) const { llvm::sys::path::append(path, hasColonPrefix ? libName.drop_front() : Twine("lib", libName) + ".a"); - if (llvm::sys::fs::exists(path.str())) + if (exists(path.str())) return StringRef(*new (_allocator) std::string(path.str())); } - if (hasColonPrefix && llvm::sys::fs::exists(libName.drop_front())) + if (hasColonPrefix && exists(libName.drop_front())) return libName.drop_front(); return make_error_code(llvm::errc::no_such_file_or_directory); @@ -142,21 +145,22 @@ ErrorOr<StringRef> ELFLinkingContext::searchLibrary(StringRef libName) const { ErrorOr<StringRef> ELFLinkingContext::searchFile(StringRef fileName, bool isSysRooted) const { SmallString<128> path; - if (llvm::sys::path::is_absolute(fileName) && isSysRooted) { + if (is_absolute(fileName) && isSysRooted) { path.assign(_sysrootPath); path.append(fileName); - if (llvm::sys::fs::exists(path.str())) + if (exists(path.str())) return StringRef(*new (_allocator) std::string(path.str())); - } else if (llvm::sys::fs::exists(fileName)) + } else if (exists(fileName)) { return fileName; + } - if (llvm::sys::path::is_absolute(fileName)) + if (is_absolute(fileName)) return make_error_code(llvm::errc::no_such_file_or_directory); for (StringRef dir : _inputSearchPaths) { buildSearchPath(path, dir, _sysrootPath); llvm::sys::path::append(path, fileName); - if (llvm::sys::fs::exists(path.str())) + if (exists(path.str())) return StringRef(*new (_allocator) std::string(path.str())); } return make_error_code(llvm::errc::no_such_file_or_directory); |

