summaryrefslogtreecommitdiff
path: root/lib/Linker
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-25 06:02:13 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-25 06:02:13 +0000
commit92ccf70ad448eb02f9f273d2c70ae4708b3bd0f2 (patch)
tree79e29e5f8e24b6c70ff964e42d9b438c3b11eddf /lib/Linker
parent8b5ee823c2393d15c74e2dda0c46f8a2c6f40dc8 (diff)
downloadllvm-92ccf70ad448eb02f9f273d2c70ae4708b3bd0f2.tar.gz
llvm-92ccf70ad448eb02f9f273d2c70ae4708b3bd0f2.tar.bz2
llvm-92ccf70ad448eb02f9f273d2c70ae4708b3bd0f2.tar.xz
Finish migrating VMCore to StringRef/Twine based APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77051 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r--lib/Linker/LinkItems.cpp6
-rw-r--r--lib/Linker/Linker.cpp28
2 files changed, 17 insertions, 17 deletions
diff --git a/lib/Linker/LinkItems.cpp b/lib/Linker/LinkItems.cpp
index db86005876..3c9a857148 100644
--- a/lib/Linker/LinkItems.cpp
+++ b/lib/Linker/LinkItems.cpp
@@ -70,12 +70,12 @@ Linker::LinkInItems(const ItemList& Items, ItemList& NativeItems) {
/// LinkInLibrary - links one library into the HeadModule.
///
-bool Linker::LinkInLibrary(const std::string& Lib, bool& is_native) {
+bool Linker::LinkInLibrary(const StringRef &Lib, bool& is_native) {
is_native = false;
// Determine where this library lives.
sys::Path Pathname = FindLib(Lib);
if (Pathname.isEmpty())
- return error("Cannot find library '" + Lib + "'");
+ return error("Cannot find library '" + Lib.str() + "'");
// If its an archive, try to link it in
std::string Magic;
@@ -83,7 +83,7 @@ bool Linker::LinkInLibrary(const std::string& Lib, bool& is_native) {
switch (sys::IdentifyFileType(Magic.c_str(), 64)) {
default: llvm_unreachable("Bad file type identification");
case sys::Unknown_FileType:
- return warning("Supposed library '" + Lib + "' isn't a library.");
+ return warning("Supposed library '" + Lib.str() + "' isn't a library.");
case sys::Bitcode_FileType:
// LLVM ".so" file.
diff --git a/lib/Linker/Linker.cpp b/lib/Linker/Linker.cpp
index 6e0b760b85..bd569b5065 100644
--- a/lib/Linker/Linker.cpp
+++ b/lib/Linker/Linker.cpp
@@ -16,10 +16,10 @@
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Config/config.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/Streams.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-Linker::Linker(const std::string& progname, const std::string& modname,
+Linker::Linker(const StringRef &progname, const StringRef &modname,
LLVMContext& C, unsigned flags):
Context(C),
Composite(new Module(modname, C)),
@@ -28,7 +28,7 @@ Linker::Linker(const std::string& progname, const std::string& modname,
Error(),
ProgramName(progname) { }
-Linker::Linker(const std::string& progname, Module* aModule, unsigned flags) :
+Linker::Linker(const StringRef &progname, Module* aModule, unsigned flags) :
Context(aModule->getContext()),
Composite(aModule),
LibPaths(),
@@ -41,25 +41,25 @@ Linker::~Linker() {
}
bool
-Linker::error(const std::string& message) {
+Linker::error(const StringRef &message) {
Error = message;
if (!(Flags&QuietErrors))
- cerr << ProgramName << ": error: " << message << "\n";
+ errs() << ProgramName << ": error: " << message << "\n";
return true;
}
bool
-Linker::warning(const std::string& message) {
+Linker::warning(const StringRef &message) {
Error = message;
if (!(Flags&QuietWarnings))
- cerr << ProgramName << ": warning: " << message << "\n";
+ errs() << ProgramName << ": warning: " << message << "\n";
return false;
}
void
-Linker::verbose(const std::string& message) {
+Linker::verbose(const StringRef &message) {
if (Flags&Verbose)
- cerr << " " << message << "\n";
+ errs() << " " << message << "\n";
}
void
@@ -117,13 +117,13 @@ Linker::LoadObject(const sys::Path &FN) {
// IsLibrary - Determine if "Name" is a library in "Directory". Return
// a non-empty sys::Path if its found, an empty one otherwise.
-static inline sys::Path IsLibrary(const std::string& Name,
- const sys::Path& Directory) {
+static inline sys::Path IsLibrary(const StringRef &Name,
+ const sys::Path &Directory) {
sys::Path FullPath(Directory);
// Try the libX.a form
- FullPath.appendComponent("lib" + Name);
+ FullPath.appendComponent(("lib" + Name).str());
FullPath.appendSuffix("a");
if (FullPath.isArchive())
return FullPath;
@@ -156,7 +156,7 @@ static inline sys::Path IsLibrary(const std::string& Name,
/// Path if no matching file can be found.
///
sys::Path
-Linker::FindLib(const std::string &Filename) {
+Linker::FindLib(const StringRef &Filename) {
// Determine if the pathname can be found as it stands.
sys::Path FilePath(Filename);
if (FilePath.canRead() &&
@@ -167,7 +167,7 @@ Linker::FindLib(const std::string &Filename) {
// there.
for (unsigned Index = 0; Index != LibPaths.size(); ++Index) {
sys::Path Directory(LibPaths[Index]);
- sys::Path FullPath = IsLibrary(Filename,Directory);
+ sys::Path FullPath = IsLibrary(Filename, Directory);
if (!FullPath.isEmpty())
return FullPath;
}