aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Debugger/SourceFile.h2
-rw-r--r--include/llvm/Linker.h12
-rw-r--r--include/llvm/Support/GraphWriter.h21
-rw-r--r--include/llvm/System/Path.h32
-rw-r--r--include/llvm/System/TimeValue.h2
-rw-r--r--lib/Archive/Archive.cpp16
-rw-r--r--lib/Archive/ArchiveReader.cpp16
-rw-r--r--lib/Archive/ArchiveWriter.cpp19
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp2
-rw-r--r--lib/Debugger/ProgramInfo.cpp3
-rw-r--r--lib/Linker/LinkArchives.cpp11
-rw-r--r--lib/Linker/LinkItems.cpp22
-rw-r--r--lib/Linker/LinkModules.cpp1
-rw-r--r--lib/Linker/Linker.cpp17
-rw-r--r--lib/Support/GraphWriter.cpp5
-rw-r--r--lib/Support/SystemUtils.cpp1
-rw-r--r--lib/System/Path.cpp9
-rw-r--r--lib/System/Unix/Path.inc14
-rw-r--r--lib/System/Unix/Program.inc4
-rw-r--r--lib/System/Unix/TimeValue.inc2
-rw-r--r--lib/System/Win32/Path.inc4
-rw-r--r--lib/System/Win32/Program.inc7
-rw-r--r--lib/System/Win32/TimeValue.inc2
-rw-r--r--tools/bugpoint/CrashDebugger.cpp4
-rw-r--r--tools/bugpoint/ExecutionDriver.cpp15
-rw-r--r--tools/bugpoint/ExtractFunction.cpp1
-rw-r--r--tools/bugpoint/FindBugs.cpp1
-rw-r--r--tools/bugpoint/Miscompilation.cpp39
-rw-r--r--tools/bugpoint/OptimizerDriver.cpp38
-rw-r--r--tools/bugpoint/ToolRunner.cpp21
-rw-r--r--tools/lli/lli.cpp1
-rw-r--r--tools/llvm-ar/llvm-ar.cpp23
-rw-r--r--tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp1
-rw-r--r--tools/llvm-db/Commands.cpp127
-rw-r--r--tools/llvm-db/llvm-db.cpp8
-rw-r--r--tools/llvm-ld/llvm-ld.cpp16
-rw-r--r--tools/llvm-link/llvm-link.cpp3
-rw-r--r--tools/lto/LTOCodeGenerator.cpp5
-rw-r--r--utils/TableGen/LLVMCConfigurationEmitter.cpp6
39 files changed, 251 insertions, 282 deletions
diff --git a/include/llvm/Debugger/SourceFile.h b/include/llvm/Debugger/SourceFile.h
index 249435af8b..155b45f25b 100644
--- a/include/llvm/Debugger/SourceFile.h
+++ b/include/llvm/Debugger/SourceFile.h
@@ -60,7 +60,7 @@ namespace llvm {
/// getFilename - Return the fully resolved path that this file was loaded
/// from.
- const std::string &getFilename() const { return Filename.toString(); }
+ const std::string &getFilename() const { return Filename.str(); }
/// getSourceLine - Given a line number, return the start and end of the
/// line in the file. If the line number is invalid, or if the file could
diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h
index 2f3d374082..1e1da86711 100644
--- a/include/llvm/Linker.h
+++ b/include/llvm/Linker.h
@@ -14,11 +14,12 @@
#ifndef LLVM_LINKER_H
#define LLVM_LINKER_H
-#include "llvm/System/Path.h"
#include <memory>
#include <vector>
+#include "llvm/ADT/StringRef.h"
namespace llvm {
+ namespace sys { class Path; }
class Module;
class LLVMContext;
@@ -64,11 +65,10 @@ class Linker {
/// Construct the Linker with an empty module which will be given the
/// name \p progname. \p progname will also be used for error messages.
/// @brief Construct with empty module
- Linker(
- const StringRef& progname, ///< name of tool running linker
- const StringRef& modulename, ///< name of linker's end-result module
- LLVMContext& C, ///< Context for global info
- unsigned Flags = 0 ///< ControlFlags (one or more |'d together)
+ Linker(const StringRef &progname, ///< name of tool running linker
+ const StringRef &modulename, ///< name of linker's end-result module
+ LLVMContext &C, ///< Context for global info
+ unsigned Flags = 0 ///< ControlFlags (one or more |'d together)
);
/// Construct the Linker with a previously defined module, \p aModule. Use
diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h
index f77b3db673..b88dd3f9a6 100644
--- a/include/llvm/Support/GraphWriter.h
+++ b/include/llvm/Support/GraphWriter.h
@@ -257,10 +257,8 @@ raw_ostream &WriteGraph(raw_ostream &O, const GraphType &G,
}
template<typename GraphType>
-sys::Path WriteGraph(const GraphType &G,
- const std::string& Name,
- bool ShortNames = false,
- const std::string& Title = "") {
+sys::Path WriteGraph(const GraphType &G, const std::string &Name,
+ bool ShortNames = false, const std::string &Title = "") {
std::string ErrMsg;
sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg);
if (Filename.isEmpty()) {
@@ -273,7 +271,7 @@ sys::Path WriteGraph(const GraphType &G,
return sys::Path();
}
- errs() << "Writing '" << Filename << "'... ";
+ errs() << "Writing '" << Filename.str() << "'... ";
std::string ErrorInfo;
raw_fd_ostream O(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force);
@@ -282,7 +280,7 @@ sys::Path WriteGraph(const GraphType &G,
WriteGraph(O, G, ShortNames, Name, Title);
errs() << " done. \n";
} else {
- errs() << "error opening file '" << Filename << "' for writing!\n";
+ errs() << "error opening file '" << Filename.str() << "' for writing!\n";
Filename.clear();
}
@@ -293,16 +291,13 @@ sys::Path WriteGraph(const GraphType &G,
/// then cleanup. For use from the debugger.
///
template<typename GraphType>
-void ViewGraph(const GraphType& G,
- const std::string& Name,
- bool ShortNames = false,
- const std::string& Title = "",
+void ViewGraph(const GraphType &G, const std::string &Name,
+ bool ShortNames = false, const std::string &Title = "",
GraphProgram::Name Program = GraphProgram::DOT) {
- sys::Path Filename = WriteGraph(G, Name, ShortNames, Title);
+ sys::Path Filename = WriteGraph(G, Name, ShortNames, Title);
- if (Filename.isEmpty()) {
+ if (Filename.isEmpty())
return;
- }
DisplayGraph(Filename, true, Program);
}
diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h
index 54c1066b52..3b73a128fb 100644
--- a/include/llvm/System/Path.h
+++ b/include/llvm/System/Path.h
@@ -15,11 +15,9 @@
#define LLVM_SYSTEM_PATH_H
#include "llvm/System/TimeValue.h"
-#include "llvm/Support/raw_ostream.h"
#include <set>
#include <string>
#include <vector>
-#include <iosfwd>
namespace llvm {
namespace sys {
@@ -217,7 +215,7 @@ namespace sys {
/// Compares \p this Path with \p that Path for inequality.
/// @returns true if \p this and \p that refer to different things.
/// @brief Inequality Operator
- bool operator!=(const Path &that) const;
+ bool operator!=(const Path &that) const { return !(*this == that); }
/// Determines if \p this Path is less than \p that Path. This is required
/// so that Path objects can be placed into ordered collections (e.g.
@@ -249,13 +247,7 @@ namespace sys {
/// @brief Determines if the path name is empty (invalid).
bool isEmpty() const { return path.empty(); }
- /// This function returns the current contents of the path as a
- /// std::string. This allows the underlying path string to be manipulated.
- /// @returns std::string containing the path name.
- /// @brief Returns the path as a std::string.
- const std::string &toString() const { return path; }
-
- /// This function returns the last component of the path name. The last
+ /// This function returns the last component of the path name. The last
/// component is the file or directory name occuring after the last
/// directory separator. If no directory separator is present, the entire
/// path name is returned (i.e. same as toString).
@@ -286,6 +278,8 @@ namespace sys {
/// @returns a 'C' string containing the path name.
/// @brief Returns the path as a C string.
const char *c_str() const { return path.c_str(); }
+ const std::string &str() const { return path; }
+
/// size - Return the length in bytes of this path name.
size_t size() const { return path.size(); }
@@ -716,24 +710,6 @@ namespace sys {
extern const char PathSeparator;
}
-inline raw_ostream& operator<<(raw_ostream& strm, const sys::Path& aPath) {
- strm << aPath.toString();
- return strm;
-}
-
-inline raw_ostream& operator<<(raw_ostream& strm,
- const sys::PathWithStatus& aPath) {
- strm << static_cast<const sys::Path&>(aPath);
- return strm;
-}
-
-std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath);
-inline std::ostream& operator<<(std::ostream& strm,
- const sys::PathWithStatus& aPath) {
- strm << static_cast<const sys::Path&>(aPath);
- return strm;
-}
-
}
#endif
diff --git a/include/llvm/System/TimeValue.h b/include/llvm/System/TimeValue.h
index b9ada00712..4e419f1b7a 100644
--- a/include/llvm/System/TimeValue.h
+++ b/include/llvm/System/TimeValue.h
@@ -271,7 +271,7 @@ namespace sys {
/// Provides conversion of the TimeValue into a readable time & date.
/// @returns std::string containing the readable time value
/// @brief Convert time to a string.
- std::string toString() const;
+ std::string str() const;
/// @}
/// @name Mutators
diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp
index 7811b6cc57..00778d9983 100644
--- a/lib/Archive/Archive.cpp
+++ b/lib/Archive/Archive.cpp
@@ -31,7 +31,7 @@ ArchiveMember::getMemberSize() const {
// If it has a long filename, include the name length
if (hasLongFilename())
- result += path.toString().length() + 1;
+ result += path.str().length() + 1;
// If its now odd lengthed, include the padding byte
if (result % 2 != 0 )
@@ -76,38 +76,38 @@ bool ArchiveMember::replaceWith(const sys::Path& newFile, std::string* ErrMsg) {
path = newFile;
// SVR4 symbol tables have an empty name
- if (path.toString() == ARFILE_SVR4_SYMTAB_NAME)
+ if (path.str() == ARFILE_SVR4_SYMTAB_NAME)
flags |= SVR4SymbolTableFlag;
else
flags &= ~SVR4SymbolTableFlag;
// BSD4.4 symbol tables have a special name
- if (path.toString() == ARFILE_BSD4_SYMTAB_NAME)
+ if (path.str() == ARFILE_BSD4_SYMTAB_NAME)
flags |= BSD4SymbolTableFlag;
else
flags &= ~BSD4SymbolTableFlag;
// LLVM symbol tables have a very specific name
- if (path.toString() == ARFILE_LLVM_SYMTAB_NAME)
+ if (path.str() == ARFILE_LLVM_SYMTAB_NAME)
flags |= LLVMSymbolTableFlag;
else
flags &= ~LLVMSymbolTableFlag;
// String table name
- if (path.toString() == ARFILE_STRTAB_NAME)
+ if (path.str() == ARFILE_STRTAB_NAME)
flags |= StringTableFlag;
else
flags &= ~StringTableFlag;
// If it has a slash then it has a path
- bool hasSlash = path.toString().find('/') != std::string::npos;
+ bool hasSlash = path.str().find('/') != std::string::npos;
if (hasSlash)
flags |= HasPathFlag;
else
flags &= ~HasPathFlag;
// If it has a slash or its over 15 chars then its a long filename format
- if (hasSlash || path.toString().length() > 15)
+ if (hasSlash || path.str().length() > 15)
flags |= HasLongFilenameFlag;
else
flags &= ~HasLongFilenameFlag;
@@ -217,7 +217,7 @@ bool llvm::GetBitcodeSymbols(const sys::Path& fName,
std::auto_ptr<MemoryBuffer> Buffer(
MemoryBuffer::getFileOrSTDIN(fName.c_str()));
if (!Buffer.get()) {
- if (ErrMsg) *ErrMsg = "Could not open file '" + fName.toString() + "'";
+ if (ErrMsg) *ErrMsg = "Could not open file '" + fName.str() + "'";
return true;
}
diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp
index 718d44608b..74895d8a6f 100644
--- a/lib/Archive/ArchiveReader.cpp
+++ b/lib/Archive/ArchiveReader.cpp
@@ -344,8 +344,8 @@ Archive::getAllModules(std::vector<Module*>& Modules,
for (iterator I=begin(), E=end(); I != E; ++I) {
if (I->isBitcode()) {
- std::string FullMemberName = archPath.toString() +
- "(" + I->getPath().toString() + ")";
+ std::string FullMemberName = archPath.str() +
+ "(" + I->getPath().str() + ")";
MemoryBuffer *Buffer =
MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str());
memcpy((char*)Buffer->getBufferStart(), I->getData(), I->getSize());
@@ -484,8 +484,8 @@ Archive::findModuleDefiningSymbol(const std::string& symbol,
return 0;
// Now, load the bitcode module to get the ModuleProvider
- std::string FullMemberName = archPath.toString() + "(" +
- mbr->getPath().toString() + ")";
+ std::string FullMemberName = archPath.str() + "(" +
+ mbr->getPath().str() + ")";
MemoryBuffer *Buffer =MemoryBuffer::getNewMemBuffer(mbr->getSize(),
FullMemberName.c_str());
memcpy((char*)Buffer->getBufferStart(), mbr->getData(), mbr->getSize());
@@ -534,8 +534,8 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols,
if (mbr->isBitcode()) {
// Get the symbols
std::vector<std::string> symbols;
- std::string FullMemberName = archPath.toString() + "(" +
- mbr->getPath().toString() + ")";
+ std::string FullMemberName = archPath.str() + "(" +
+ mbr->getPath().str() + ")";
ModuleProvider* MP =
GetBitcodeSymbols((const unsigned char*)At, mbr->getSize(),
FullMemberName, Context, symbols, error);
@@ -552,7 +552,7 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols,
} else {
if (error)
*error = "Can't parse bitcode member: " +
- mbr->getPath().toString() + ": " + *error;
+ mbr->getPath().str() + ": " + *error;
delete mbr;
return false;
}
@@ -612,7 +612,7 @@ bool Archive::isBitcodeArchive() {
continue;
std::string FullMemberName =
- archPath.toString() + "(" + I->getPath().toString() + ")";
+ archPath.str() + "(" + I->getPath().str() + ")";
MemoryBuffer *Buffer =
MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str());
diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp
index 881d75b3ba..d17f6b5036 100644
--- a/lib/Archive/ArchiveWriter.cpp
+++ b/lib/Archive/ArchiveWriter.cpp
@@ -95,7 +95,7 @@ Archive::fillHeader(const ArchiveMember &mbr, ArchiveMemberHeader& hdr,
memcpy(hdr.date,buffer,12);
// Get rid of trailing blanks in the name
- std::string mbrPath = mbr.getPath().toString();
+ std::string mbrPath = mbr.getPath().str();
size_t mbrLen = mbrPath.length();
while (mbrLen > 0 && mbrPath[mbrLen-1] == ' ') {
mbrPath.erase(mbrLen-1,1);
@@ -173,10 +173,10 @@ Archive::addFileBefore(const sys::Path& filePath, iterator where,
mbr->info = *FSInfo;
unsigned flags = 0;
- bool hasSlash = filePath.toString().find('/') != std::string::npos;
+ bool hasSlash = filePath.str().find('/') != std::string::npos;
if (hasSlash)
flags |= ArchiveMember::HasPathFlag;
- if (hasSlash || filePath.toString().length() > 15)
+ if (hasSlash || filePath.str().length() > 15)
flags |= ArchiveMember::HasLongFilenameFlag;
std::string magic;
mbr->path.getMagicNumber(magic,4);
@@ -223,8 +223,7 @@ Archive::writeMember(
// symbol table if its a bitcode file.
if (CreateSymbolTable && member.isBitcode()) {
std::vector<std::string> symbols;
- std::string FullMemberName = archPath.toString() + "(" +
- member.getPath().toString()
+ std::string FullMemberName = archPath.str() + "(" + member.getPath().str()
+ ")";
ModuleProvider* MP =
GetBitcodeSymbols((const unsigned char*)data,fSize,
@@ -249,7 +248,7 @@ Archive::writeMember(
} else {
delete mFile;
if (ErrMsg)
- *ErrMsg = "Can't parse bitcode member: " + member.getPath().toString()
+ *ErrMsg = "Can't parse bitcode member: " + member.getPath().str()
+ ": " + *ErrMsg;
return true;
}
@@ -266,8 +265,8 @@ Archive::writeMember(
// Write the long filename if its long
if (writeLongName) {
- ARFile.write(member.getPath().toString().data(),
- member.getPath().toString().length());
+ ARFile.write(member.getPath().str().data(),
+ member.getPath().str().length());
}
// Write the (possibly compressed) member's content to the file.
@@ -371,7 +370,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
if (TmpArchive.exists())
TmpArchive.eraseFromDisk();
if (ErrMsg)
- *ErrMsg = "Error opening archive file: " + archPath.toString();
+ *ErrMsg = "Error opening archive file: " + archPath.str();
return true;
}
@@ -425,7 +424,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
if (TmpArchive.exists())
TmpArchive.eraseFromDisk();
if (ErrMsg)
- *ErrMsg = "Error opening archive file: " + FinalFilePath.toString();
+ *ErrMsg = "Error opening archive file: " + FinalFilePath.str();
return true;
}
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 83a7772206..ab86998750 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1343,7 +1343,7 @@ void DwarfDebug::BeginModule(Module *M, MachineModuleInfo *mmi) {
FullPath.appendComponent(getSourceFileName(Id.second));
assert(AppendOk && "Could not append filename to directory!");
AppendOk = false;
- Asm->EmitFile(i, FullPath.toString());
+ Asm->EmitFile(i, FullPath.str());
Asm->EOL();
}
}
diff --git a/lib/Debugger/ProgramInfo.cpp b/lib/Debugger/ProgramInfo.cpp
index f649ebe581..5ba1c708ab 100644
--- a/lib/Debugger/ProgramInfo.cpp
+++ b/lib/Debugger/ProgramInfo.cpp
@@ -22,6 +22,7 @@
#include "llvm/Module.h"
#include "llvm/Debugger/SourceFile.h"
#include "llvm/Debugger/SourceLanguage.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/SlowOperationInformer.h"
#include "llvm/ADT/STLExtras.h"
using namespace llvm;
@@ -135,7 +136,7 @@ SourceFile &SourceFileInfo::getSourceText() const {
tmpPath.set(Directory);
tmpPath.appendComponent(BaseName);
if (tmpPath.canRead())
- SourceText = new SourceFile(tmpPath.toString(), Descriptor);
+ SourceText = new SourceFile(tmpPath.str(), Descriptor);
else
SourceText = new SourceFile(BaseName, Descriptor);
}
diff --git a/lib/Linker/LinkArchives.cpp b/lib/Linker/LinkArchives.cpp
index faf01af127..76d81c2194 100644
--- a/lib/Linker/LinkArchives.cpp
+++ b/lib/Linker/LinkArchives.cpp
@@ -96,10 +96,10 @@ bool
Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) {
// Make sure this is an archive file we're dealing with
if (!Filename.isArchive())
- return error("File '" + Filename.toString() + "' is not an archive.");
+ return error("File '" + Filename.str() + "' is not an archive.");
// Open the archive file
- verbose("Linking archive file '" + Filename.toString() + "'");
+ verbose("Linking archive file '" + Filename.str() + "'");
// Find all of the symbols currently undefined in the bitcode program.
// If all the symbols are defined, the program is complete, and there is
@@ -108,8 +108,7 @@ Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) {
GetAllUndefinedSymbols(Composite, UndefinedSymbols);
if (UndefinedSymbols.empty()) {
- verbose("No symbols undefined, skipping library '" +
- Filename.toString() + "'");
+ verbose("No symbols undefined, skipping library '" + Filename.str() + "'");
return false; // No need to link anything in!
}
@@ -120,7 +119,7 @@ Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) {
Archive* arch = AutoArch.get();
if (!arch)
- return error("Cannot read archive '" + Filename.toString() +
+ return error("Cannot read archive '" + Filename.str() +
"': " + ErrMsg);
if (!arch->isBitcodeArchive()) {
is_native = true;
@@ -143,7 +142,7 @@ Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) {
// Find the modules we need to link into the target module
std::set<ModuleProvider*> Modules;
if (!arch->findModulesDefiningSymbols(UndefinedSymbols, Modules, &ErrMsg))
- return error("Cannot find symbols in '" + Filename.toString() +
+ return error("Cannot find symbols in '" + Filename.str() +
"': " + ErrMsg);
// If we didn't find any more modules to link this time, we are done
diff --git a/lib/Linker/LinkItems.cpp b/lib/Linker/LinkItems.cpp
index 3c9a857148..61f3c26c6a 100644
--- a/lib/Linker/LinkItems.cpp
+++ b/lib/Linker/LinkItems.cpp
@@ -14,10 +14,10 @@
#include "llvm/Linker.h"
#include "llvm/Module.h"
+#include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/System/Path.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Bitcode/ReaderWriter.h"
-
using namespace llvm;
// LinkItems - This function is the main entry point into linking. It takes a
@@ -93,7 +93,7 @@ bool Linker::LinkInLibrary(const StringRef &Lib, bool& is_native) {
case sys::Archive_FileType:
if (LinkInArchive(Pathname, is_native))
- return error("Cannot link archive '" + Pathname.toString() + "'");
+ return error("Cannot link archive '" + Pathname.str() + "'");
break;
case sys::ELF_Relocatable_FileType:
@@ -158,7 +158,7 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) {
is_native = false;
// Check for a file of name "-", which means "read standard input"
- if (File.toString() == "-") {
+ if (File.str() == "-") {
std::auto_ptr<Module> M;
if (MemoryBuffer *Buffer = MemoryBuffer::getSTDIN()) {
M.reset(ParseBitcodeFile(Buffer, Context, &Error));
@@ -173,7 +173,7 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) {
// Make sure we can at least read the file
if (!File.canRead())
- return error("Cannot find linker input '" + File.toString() + "'");
+ return error("Cannot find linker input '" + File.str() + "'");
// If its an archive, try to link it in
std::string Magic;
@@ -181,26 +181,26 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) {
switch (sys::IdentifyFileType(Magic.c_str(), 64)) {
default: llvm_unreachable("Bad file type identification");
case sys::Unknown_FileType:
- return warning("Ignoring file '" + File.toString() +
+ return warning("Ignoring file '" + File.str() +
"' because does not contain bitcode.");
case sys::Archive_FileType:
// A user may specify an ar archive without -l, perhaps because it
// is not installed as a library. Detect that and link the archive.
- verbose("Linking archive file '" + File.toString() + "'");
+ verbose("Linking archive file '" + File.str() + "'");
if (LinkInArchive(File, is_native))
return true;
break;
case sys::Bitcode_FileType: {
- verbose("Linking bitcode file '" + File.toString() + "'");
+ verbose("Linking bitcode file '" + File.str() + "'");
std::auto_ptr<Module> M(LoadObject(File));
if (M.get() == 0)
- return error("Cannot load file '" + File.toString() + "': " + Error);
+ return error("Cannot load file '" + File.str() + "': " + Error);
if (LinkInModule(M.get(), &Error))
- return error("Cannot link file '" + File.toString() + "': " + Error);
+ return error("Cannot link file '" + File.str() + "': " + Error);
- verbose("Linked in file '" + File.toString() + "'");
+ verbose("Linked in file '" + File.str() + "'");
break;
}
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index effba471e0..0fa97c5568 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -26,6 +26,7 @@
#include "llvm/Instructions.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
#include "llvm/ADT/DenseMap.h"
#include <sstream>
diff --git a/lib/Linker/Linker.cpp b/lib/Linker/Linker.cpp
index bd569b5065..aef79d08f4 100644
--- a/lib/Linker/Linker.cpp
+++ b/lib/Linker/Linker.cpp
@@ -14,9 +14,10 @@
#include "llvm/Linker.h"
#include "llvm/Module.h"
#include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/Config/config.h"
+#include "llvm/System/Path.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Config/config.h"
using namespace llvm;
Linker::Linker(const StringRef &progname, const StringRef &modname,
@@ -69,11 +70,8 @@ Linker::addPath(const sys::Path& path) {
void
Linker::addPaths(const std::vector<std::string>& paths) {
- for (unsigned i = 0; i != paths.size(); ++i) {
- sys::Path aPath;
- aPath.set(paths[i]);
- LibPaths.push_back(aPath);
- }
+ for (unsigned i = 0, e = paths.size(); i != e; ++i)
+ LibPaths.push_back(sys::Path(paths[i]));
}
void
@@ -100,16 +98,15 @@ Linker::LoadObject(const sys::Path &FN) {
std::string ParseErrorMessage;
Module *Result = 0;
- const std::string &FNS = FN.toString();
- std::auto_ptr<MemoryBuffer> Buffer(MemoryBuffer::getFileOrSTDIN(FNS.c_str()));
+ std::auto_ptr<MemoryBuffer> Buffer(MemoryBuffer::getFileOrSTDIN(FN.c_str()));
if (Buffer.get())
Result = ParseBitcodeFile(Buffer.get(), Context, &ParseErrorMessage);
else
- ParseErrorMessage = "Error reading file '" + FNS + "'";
+ ParseErrorMessage = "Error reading file '" + FN.str() + "'";
if (Result)
return std::auto_ptr<Module>(Result);
- Error = "Bitcode file '" + FN.toString() + "' could not be loaded";
+ Error = "Bitcode file '" + FN.str() + "' could not be loaded";
if (ParseErrorMessage.size())
Error += ": " + ParseErrorMessage;
return std::auto_ptr<Module>();
diff --git a/lib/Support/GraphWriter.cpp b/lib/Support/GraphWriter.cpp
index 9d72db1bd2..a3d2d6c871 100644
--- a/lib/Support/GraphWriter.cpp
+++ b/lib/Support/GraphWriter.cpp
@@ -64,9 +64,10 @@ void llvm::DisplayGraph(const sys::Path &Filename, bool wait,
errs() << "Running 'Graphviz' program... ";
if (sys::Program::ExecuteAndWait(Graphviz, &args[0],0,0,0,0,&ErrMsg))
- errs() << "Error viewing graph " << Filename << ": " << ErrMsg << "\n";
+ errs() << "Error viewing graph " << Filename.str() << ": " << ErrMsg
+ << "\n";
else
- Filename.eraseFromDisk();
+ Filename.eraseFromDisk();
#elif (HAVE_GV && (HAVE_DOT || HAVE_FDP || HAVE_NEATO || \
HAVE_TWOPI || HAVE_CIRCO))
diff --git a/lib/Support/SystemUtils.cpp b/lib/Support/SystemUtils.cpp
index 7756e033ad..3d3649eaeb 100644
--- a/lib/Support/SystemUtils.cpp
+++ b/lib/Support/SystemUtils.cpp
@@ -15,6 +15,7 @@
#include "llvm/Support/SystemUtils.h"
#include "llvm/System/Process.h"
#include "llvm/System/Program.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
bool llvm::CheckBitcodeOutputToConsole(raw_ostream &stream_to_check,
diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp
index ce4762e56d..df33574809 100644
--- a/lib/System/Path.cpp
+++ b/lib/System/Path.cpp
@@ -29,19 +29,10 @@ bool Path::operator==(const Path &that) const {
return path == that.path;
}
-bool Path::operator!=(const Path &that) const {
- return path != that.path;
-}
-
bool Path::operator<(const Path& that) const {
return path < that.path;
}
-std::ostream& llvm::operator<<(std::ostream &strm, const sys::Path &aPath) {
- strm << aPath.toString();
- return strm;
-}
-
Path
Path::GetLLVMConfigDir() {
Path result;
diff --git a/lib/System/Unix/Path.inc b/