summaryrefslogtreecommitdiff
path: root/tools/llvm-link/llvm-link.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-09-12 23:39:42 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-09-12 23:39:42 +0000
commitdccc01eb61e8748ac8e40e372ed8d35b32fd84bd (patch)
tree3552d2d475e0ebb04c443799406400e7b9db28cc /tools/llvm-link/llvm-link.cpp
parenta2dfd05d849c6d715c47671901d0b980228f7cee (diff)
downloadllvm-dccc01eb61e8748ac8e40e372ed8d35b32fd84bd.tar.gz
llvm-dccc01eb61e8748ac8e40e372ed8d35b32fd84bd.tar.bz2
llvm-dccc01eb61e8748ac8e40e372ed8d35b32fd84bd.tar.xz
Excise the -L option since llvm-link should not do library searches. It
just links bytecode files together. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-link/llvm-link.cpp')
-rw-r--r--tools/llvm-link/llvm-link.cpp53
1 files changed, 11 insertions, 42 deletions
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 3fb3523fb7..150ab0d65a 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -42,17 +42,21 @@ Verbose("v", cl::desc("Print information about actions taken"));
static cl::opt<bool>
DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden);
-static cl::list<std::string>
-LibPaths("L", cl::desc("Specify a library search path"), cl::ZeroOrMore,
- cl::value_desc("directory"), cl::Prefix);
+// LoadFile - Read the specified bytecode file in and return it. This routine
+// searches the link path for the specified file to try to find it...
+//
+static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
+ sys::Path Filename;
+ if (!Filename.set_file(FN)) {
+ std::cerr << "Invalid file name: '" << FN << "'\n";
+ return std::auto_ptr<Module>();
+ }
-// GetModule - This function is just factored out of the functions below
-static inline Module* GetModule(const sys::Path& Filename) {
- if (Verbose) std::cerr << "Loading '" << Filename.c_str() << "'\n";
std::string ErrorMessage;
if (Filename.exists()) {
+ if (Verbose) std::cerr << "Loading '" << Filename.c_str() << "'\n";
Module* Result = ParseBytecodeFile(Filename.get(), &ErrorMessage);
- if (Result) return Result; // Load successful!
+ if (Result) return std::auto_ptr<Module>(Result); // Load successful!
if (Verbose) {
std::cerr << "Error opening bytecode file: '" << Filename.c_str() << "'";
@@ -63,42 +67,7 @@ static inline Module* GetModule(const sys::Path& Filename) {
std::cerr << "Bytecode file: '" << Filename.c_str()
<< "' does not exist.\n";
}
- return 0;
-}
-
-// LoadFile - Read the specified bytecode file in and return it. This routine
-// searches the link path for the specified file to try to find it...
-//
-static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
- sys::Path Filename;
- if (!Filename.set_file(FN)) {
- std::cerr << "Invalid file name: '" << Filename.c_str() << "'\n";
- return std::auto_ptr<Module>();
- }
-
- if (Module* Result = GetModule(Filename))
- return std::auto_ptr<Module>(Result);
-
- bool FoundAFile = false;
-
- for (unsigned i = 0; i < LibPaths.size(); i++) {
- if (!Filename.set_directory(LibPaths[i])) {
- std::cerr << "Invalid library path: '" << LibPaths[i] << "'\n";
- } else if (!Filename.append_file(FN)) {
- std::cerr << "Invalid library path: '" << LibPaths[i]
- << "/" << FN.c_str() << "'\n";
- } else if (Filename.exists()) {
- FoundAFile = true;
- if (Module *Result = GetModule(Filename))
- return std::auto_ptr<Module>(Result); // Load successful!
- }
- }
- if (FoundAFile)
- std::cerr << "Bytecode file '" << FN << "' corrupt! "
- << "Use 'llvm-link -v ...' for more info.\n";
- else
- std::cerr << "Could not locate bytecode file: '" << FN << "'\n";
return std::auto_ptr<Module>();
}