diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-23 22:45:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-23 22:45:37 +0000 |
commit | 74382b7c699120fbec5cb5603c9cf4212eb37f06 (patch) | |
tree | c8c2c5b8879b256c428b0d35841b9cce1c2cc51c /lib | |
parent | 983c592272eb59d39fd78c515e1f2701638879e0 (diff) | |
download | external_llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.zip external_llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.gz external_llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.bz2 |
Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files.
This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
instead.
4. Weans llvm-db off <iostream>
sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Archive/Archive.cpp | 16 | ||||
-rw-r--r-- | lib/Archive/ArchiveReader.cpp | 16 | ||||
-rw-r--r-- | lib/Archive/ArchiveWriter.cpp | 19 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 2 | ||||
-rw-r--r-- | lib/Debugger/ProgramInfo.cpp | 3 | ||||
-rw-r--r-- | lib/Linker/LinkArchives.cpp | 11 | ||||
-rw-r--r-- | lib/Linker/LinkItems.cpp | 22 | ||||
-rw-r--r-- | lib/Linker/LinkModules.cpp | 1 | ||||
-rw-r--r-- | lib/Linker/Linker.cpp | 17 | ||||
-rw-r--r-- | lib/Support/GraphWriter.cpp | 5 | ||||
-rw-r--r-- | lib/Support/SystemUtils.cpp | 1 | ||||
-rw-r--r-- | lib/System/Path.cpp | 9 | ||||
-rw-r--r-- | lib/System/Unix/Path.inc | 14 | ||||
-rw-r--r-- | lib/System/Unix/Program.inc | 4 | ||||
-rw-r--r-- | lib/System/Unix/TimeValue.inc | 2 | ||||
-rw-r--r-- | lib/System/Win32/Path.inc | 4 | ||||
-rw-r--r-- | lib/System/Win32/Program.inc | 7 | ||||
-rw-r--r-- | lib/System/Win32/TimeValue.inc | 2 |
18 files changed, 72 insertions, 83 deletions
diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp index 7811b6c..00778d9 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 718d446..74895d8 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 881d75b..d17f6b5 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 83a7772..ab86998 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 f649ebe..5ba1c70 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 faf01af..76d81c2 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 3c9a857..61f3c26 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 effba47..0fa97c5 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 bd569b5..aef79d0 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 9d72db1..a3d2d6c 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 7756e03..3d3649e 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 ce4762e..df33574 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/lib/System/Unix/Path.inc index a54fcfd..7139f4e 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -119,7 +119,7 @@ void Path::makeAbsolute() { CWD.appendComponent(path); - path = CWD.toString(); + path = CWD.str(); } Path @@ -502,7 +502,7 @@ static bool AddPermissionBits(const Path &File, int bits) { // Get the file's current mode. struct stat buf; - if (0 != stat(File.toString().c_str(), &buf)) + if (0 != stat(File.c_str(), &buf)) return false; // Change the file to have whichever permissions bits from 'bits' // that the umask would not disable. @@ -759,7 +759,7 @@ bool Path::renamePathOnDisk(const Path& newName, std::string* ErrMsg) { if (0 != ::rename(path.c_str(), newName.c_str())) return MakeErrMsg(ErrMsg, std::string("can't rename '") + path + "' as '" + - newName.toString() + "'"); + newName.str() + "'"); return false; } @@ -781,13 +781,13 @@ sys::CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg){ int outFile = -1; inFile = ::open(Src.c_str(), O_RDONLY); if (inFile == -1) - return MakeErrMsg(ErrMsg, Src.toString() + + return MakeErrMsg(ErrMsg, Src.str() + ": can't open source file to copy"); outFile = ::open(Dest.c_str(), O_WRONLY|O_CREAT, 0666); if (outFile == -1) { ::close(inFile); - return MakeErrMsg(ErrMsg, Dest.toString() + + return MakeErrMsg(ErrMsg, Dest.str() + ": can't create destination file for copy"); } @@ -797,7 +797,7 @@ sys::CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg){ if (errno != EINTR && errno != EAGAIN) { ::close(inFile); ::close(outFile); - return MakeErrMsg(ErrMsg, Src.toString()+": can't read source file"); + return MakeErrMsg(ErrMsg, Src.str()+": can't read source file"); } } else { char *BufPtr = Buffer; @@ -807,7 +807,7 @@ sys::CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg){ if (errno != EINTR && errno != EAGAIN) { ::close(inFile); ::close(outFile); - return MakeErrMsg(ErrMsg, Dest.toString() + + return MakeErrMsg(ErrMsg, Dest.str() + ": can't write destination file"); } } else { diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc index 14bc7b1..84e025c 100644 --- a/lib/System/Unix/Program.inc +++ b/lib/System/Unix/Program.inc @@ -97,7 +97,7 @@ static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) { // Redirect empty paths to /dev/null File = "/dev/null"; else - File = Path->toString(); + File = Path->str(); // Open the file int InFD = open(File.c_str(), FD == 0 ? O_RDONLY : O_WRONLY|O_CREAT, 0666); @@ -156,7 +156,7 @@ Program::Execute(const Path& path, { if (!path.canExecute()) { if (ErrMsg) - *ErrMsg = path.toString() + " is not executable"; + *ErrMsg = path.str() + " is not executable"; return false; } diff --git a/lib/System/Unix/TimeValue.inc b/lib/System/Unix/TimeValue.inc index 8dd30b9..1ae8c71 100644 --- a/lib/System/Unix/TimeValue.inc +++ b/lib/System/Unix/TimeValue.inc @@ -21,7 +21,7 @@ namespace llvm { using namespace sys; -std::string TimeValue::toString() const { +std::string TimeValue::str() const { char buffer[32]; time_t ourTime = time_t(this->toEpochTime()); diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index fccf001..46b965f 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -808,8 +808,8 @@ CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg) { // Can't use CopyFile macro defined in Windows.h because it would mess up the // above line. We use the expansion it would have in a non-UNICODE build. if (!::CopyFileA(Src.c_str(), Dest.c_str(), false)) - return MakeErrMsg(ErrMsg, "Can't copy '" + Src.toString() + - "' to '" + Dest.toString() + "': "); + return MakeErrMsg(ErrMsg, "Can't copy '" + Src.str() + + "' to '" + Dest.str() + "': "); return false; } diff --git a/lib/System/Win32/Program.inc b/lib/System/Win32/Program.inc index 005f631..804273b 100644 --- a/lib/System/Win32/Program.inc +++ b/lib/System/Win32/Program.inc @@ -92,7 +92,7 @@ static HANDLE RedirectIO(const Path *path, int fd, std::string* ErrMsg) { if (path->isEmpty()) fname = "NUL"; else - fname = path->toString().c_str(); + fname = path->c_str(); SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); @@ -258,11 +258,10 @@ Program::Execute(const Path& path, CloseHandle(si.hStdError); // Now return an error if the process didn't get created. - if (!rc) - { + if (!rc) { SetLastError(err); MakeErrMsg(ErrMsg, std::string("Couldn't execute program '") + - path.toString() + "'"); + path.str() + "'"); return false; } Pid_ = pi.dwProcessId; diff --git a/lib/System/Win32/TimeValue.inc b/lib/System/Win32/TimeValue.inc index 0ca87d4..e37f111 100644 --- a/lib/System/Win32/TimeValue.inc +++ b/lib/System/Win32/TimeValue.inc @@ -30,7 +30,7 @@ TimeValue TimeValue::now() { return t; } -std::string TimeValue::toString() const { +std::string TimeValue::str() const { #ifdef __MINGW32__ // This ban may be lifted by either: // (i) a future MinGW version other than 1.0 inherents the __time64_t type, or |