mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-03 14:31:10 +00:00
Qualify Path with sys:: namespace so this file compiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16516 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
725f2c82c9
commit
8d9b6800f6
@ -25,6 +25,7 @@
|
|||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
#include "llvm/Support/FileUtilities.h"
|
||||||
#include "llvm/System/Signals.h"
|
#include "llvm/System/Signals.h"
|
||||||
|
#include "llvm/System/Path.h"
|
||||||
#include "llvm/Support/SystemUtils.h"
|
#include "llvm/Support/SystemUtils.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -43,37 +44,15 @@ std::string llvm::FindLib(const std::string &Filename,
|
|||||||
const std::vector<std::string> &Paths,
|
const std::vector<std::string> &Paths,
|
||||||
bool SharedObjectOnly) {
|
bool SharedObjectOnly) {
|
||||||
// Determine if the pathname can be found as it stands.
|
// Determine if the pathname can be found as it stands.
|
||||||
if (FileOpenable(Filename))
|
sys::Path FilePath;
|
||||||
|
if (FilePath.set_file(Filename) && FilePath.readable())
|
||||||
return Filename;
|
return Filename;
|
||||||
|
|
||||||
// If that doesn't work, convert the name into a library name.
|
// Ask the System Path object to locate the library. This ensures that
|
||||||
std::string LibName = "lib" + Filename;
|
// the library search is done correctly for a given platform.
|
||||||
|
sys::Path LibPath = sys::Path::GetLibraryPath(Filename,Paths);
|
||||||
|
|
||||||
// Iterate over the directories in Paths to see if we can find the library
|
return LibPath.get();
|
||||||
// there.
|
|
||||||
for (unsigned Index = 0; Index != Paths.size(); ++Index) {
|
|
||||||
std::string Directory = Paths[Index] + "/";
|
|
||||||
|
|
||||||
if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".bc"))
|
|
||||||
return Directory + LibName + ".bc";
|
|
||||||
|
|
||||||
if (FileOpenable(Directory + LibName + SHLIBEXT))
|
|
||||||
return Directory + LibName + SHLIBEXT;
|
|
||||||
|
|
||||||
if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".a"))
|
|
||||||
return Directory + LibName + ".a";
|
|
||||||
}
|
|
||||||
|
|
||||||
// One last hope: Check LLVM_LIB_SEARCH_PATH.
|
|
||||||
char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH");
|
|
||||||
if (SearchPath == NULL)
|
|
||||||
return std::string();
|
|
||||||
|
|
||||||
LibName = std::string(SearchPath) + "/" + LibName;
|
|
||||||
if (FileOpenable(LibName))
|
|
||||||
return LibName;
|
|
||||||
|
|
||||||
return std::string();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the
|
/// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user