[lld] r233458 - ELF: make code concise using "using".
Rui Ueyama
ruiu at google.com
Fri Mar 27 17:34:10 PDT 2015
Author: ruiu
Date: Fri Mar 27 19:34:09 2015
New Revision: 233458
URL: http://llvm.org/viewvc/llvm-project?rev=233458&view=rev
Log:
ELF: make code concise using "using".
Modified:
lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=233458&r1=233457&r2=233458&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Fri Mar 27 19:34:09 2015
@@ -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::se
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::se
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::se
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);
More information about the llvm-commits
mailing list