[lld] r264785 - Simplify. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 29 13:53:21 PDT 2016
Author: ruiu
Date: Tue Mar 29 15:53:21 2016
New Revision: 264785
URL: http://llvm.org/viewvc/llvm-project?rev=264785&view=rev
Log:
Simplify. NFC.
Modified:
lld/trunk/ELF/DriverUtils.cpp
Modified: lld/trunk/ELF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DriverUtils.cpp?rev=264785&r1=264784&r2=264785&view=diff
==============================================================================
--- lld/trunk/ELF/DriverUtils.cpp (original)
+++ lld/trunk/ELF/DriverUtils.cpp Tue Mar 29 15:53:21 2016
@@ -99,20 +99,14 @@ std::string elf::findFromSearchPaths(Str
// Searches a given library from input search paths, which are filled
// from -L command line switches. Returns a path to an existent library file.
std::string elf::searchLibrary(StringRef Path) {
- std::vector<std::string> Names;
- if (Path[0] == ':') {
- Names.push_back(Path.drop_front());
- } else {
- if (!Config->Static)
- Names.push_back(("lib" + Path + ".so").str());
- Names.push_back(("lib" + Path + ".a").str());
- }
- for (const std::string &Name : Names) {
- std::string S = findFromSearchPaths(Name);
+ if (Path.startswith(":"))
+ return findFromSearchPaths(Path.substr(1));
+ if (!Config->Static) {
+ std::string S = findFromSearchPaths(("lib" + Path + ".so").str());
if (!S.empty())
return S;
}
- return "";
+ return findFromSearchPaths(("lib" + Path + ".a").str());
}
// Makes a path by concatenating Dir and File.
More information about the llvm-commits
mailing list