aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/System/Path.h6
-rw-r--r--lib/Archive/Archive.cpp14
-rw-r--r--lib/Archive/ArchiveReader.cpp14
-rw-r--r--lib/Archive/ArchiveWriter.cpp18
-rw-r--r--lib/Bytecode/Archive/Archive.cpp14
-rw-r--r--lib/Bytecode/Archive/ArchiveReader.cpp14
-rw-r--r--lib/Bytecode/Archive/ArchiveWriter.cpp18
-rw-r--r--lib/Bytecode/Reader/ReaderWrappers.cpp3
-rw-r--r--lib/System/Unix/MappedFile.cpp8
-rw-r--r--lib/System/Unix/MappedFile.inc8
-rw-r--r--lib/System/Unix/Path.cpp15
-rw-r--r--lib/System/Unix/Path.inc15
-rw-r--r--lib/System/Unix/Program.cpp11
-rw-r--r--lib/System/Unix/Program.inc11
-rw-r--r--lib/System/Unix/Signals.cpp2
-rw-r--r--lib/System/Unix/Signals.inc2
-rw-r--r--tools/llvm-ar/llvm-ar.cpp18
-rw-r--r--tools/llvm-link/llvm-link.cpp2
-rw-r--r--tools/llvmc/CompilerDriver.cpp67
-rw-r--r--tools/llvmc/Configuration.cpp2
-rw-r--r--tools/llvmc/llvmc.cpp2
21 files changed, 141 insertions, 123 deletions
diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h
index f9ee040dbc..90b61364b6 100644
--- a/include/llvm/System/Path.h
+++ b/include/llvm/System/Path.h
@@ -322,7 +322,7 @@ namespace sys {
/// by other software.
/// @returns std::string containing the path name.
/// @brief Returns the path as a std::string.
- std::string get() const { return path; }
+ std::string toString() const { return path; }
/// This function returns the last component of the path name. If the
/// isDirectory() function would return true then this returns the name
@@ -466,7 +466,7 @@ namespace sys {
/// @brief Create the directory this Path refers to.
bool createDirectory( bool create_parents = false );
- /// This method attempts to create a file in the file system with the same
+ /// This method attempts to create a file in the file system with the same
/// name as the Path object. The intermediate directories must all exist
/// at the time this method is called. Use createDirectories to
/// accomplish that. The created file will be empty upon return from this
@@ -500,7 +500,7 @@ namespace sys {
/// @brief Removes the file or directory from the filesystem.
bool destroyDirectory( bool destroy_contents = false );
- /// This method attempts to destroy the file named by the last item in the
+ /// This method attempts to destroy the file named by the last item in the
/// Path name.
/// @returns false if the Path does not refer to a file, true otherwise.
/// @throws std::string if there is an error.
diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp
index 8e405907e6..2d79bd66ed 100644
--- a/lib/Archive/Archive.cpp
+++ b/lib/Archive/Archive.cpp
@@ -26,7 +26,7 @@ ArchiveMember::getMemberSize() const {
// If it has a long filename, include the name length
if (hasLongFilename())
- result += path.get().length() + 1;
+ result += path.toString().length() + 1;
// If its now odd lengthed, include the padding byte
if (result % 2 != 0 )
@@ -66,38 +66,38 @@ void ArchiveMember::replaceWith(const sys::Path& newFile) {
path = newFile;
// SVR4 symbol tables have an empty name
- if (path.get() == ARFILE_SVR4_SYMTAB_NAME)
+ if (path.toString() == ARFILE_SVR4_SYMTAB_NAME)
flags |= SVR4SymbolTableFlag;
else
flags &= ~SVR4SymbolTableFlag;
// BSD4.4 symbol tables have a special name
- if (path.get() == ARFILE_BSD4_SYMTAB_NAME)
+ if (path.toString() == ARFILE_BSD4_SYMTAB_NAME)
flags |= BSD4SymbolTableFlag;
else
flags &= ~BSD4SymbolTableFlag;
// LLVM symbol tables have a very specific name
- if (path.get() == ARFILE_LLVM_SYMTAB_NAME)
+ if (path.toString() == ARFILE_LLVM_SYMTAB_NAME)
flags |= LLVMSymbolTableFlag;
else
flags &= ~LLVMSymbolTableFlag;
// String table name
- if (path.get() == ARFILE_STRTAB_NAME)
+ if (path.toString() == ARFILE_STRTAB_NAME)
flags |= StringTableFlag;
else
flags &= ~StringTableFlag;
// If it has a slash then it has a path
- bool hasSlash = path.get().find('/') != std::string::npos;
+ bool hasSlash = path.toString().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.get().length() > 15)
+ if (hasSlash || path.toString().length() > 15)
flags |= HasLongFilenameFlag;
else
flags &= ~HasLongFilenameFlag;
diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp
index 34b36a6f38..b00487f0de 100644
--- a/lib/Archive/ArchiveReader.cpp
+++ b/lib/Archive/ArchiveReader.cpp
@@ -295,8 +295,8 @@ Archive::getAllModules(std::vector<Module*>& Modules, std::string* ErrMessage) {
for (iterator I=begin(), E=end(); I != E; ++I) {
if (I->isBytecode() || I->isCompressedBytecode()) {
- std::string FullMemberName = archPath.get() +
- "(" + I->getPath().get() + ")";
+ std::string FullMemberName = archPath.toString() +
+ "(" + I->getPath().toString() + ")";
Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(),
I->getSize(), FullMemberName, ErrMessage);
if (!M)
@@ -407,8 +407,8 @@ Archive::findModuleDefiningSymbol(const std::string& symbol) {
ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size());
// Now, load the bytecode module to get the ModuleProvider
- std::string FullMemberName = archPath.get() + "(" +
- mbr->getPath().get() + ")";
+ std::string FullMemberName = archPath.toString() + "(" +
+ mbr->getPath().toString() + ")";
ModuleProvider* mp = getBytecodeBufferModuleProvider(
(const unsigned char*) mbr->getData(), mbr->getSize(),
FullMemberName, 0);
@@ -446,8 +446,8 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols,
if (mbr->isBytecode() || mbr->isCompressedBytecode()) {
// Get the symbols
std::vector<std::string> symbols;
- std::string FullMemberName = archPath.get() + "(" +
- mbr->getPath().get() + ")";
+ std::string FullMemberName = archPath.toString() + "(" +
+ mbr->getPath().toString() + ")";
ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At,
mbr->getSize(), FullMemberName, symbols);
@@ -462,7 +462,7 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols,
modules.insert(std::make_pair(offset, std::make_pair(MP, mbr)));
} else {
throw std::string("Can't parse bytecode member: ") +
- mbr->getPath().get();
+ mbr->getPath().toString();
}
}
diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp
index 21be628452..64c256718e 100644
--- a/lib/Archive/ArchiveWriter.cpp
+++ b/lib/Archive/ArchiveWriter.cpp
@@ -94,7 +94,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().get();
+ std::string mbrPath = mbr.getPath().toString();
size_t mbrLen = mbrPath.length();
while (mbrLen > 0 && mbrPath[mbrLen-1] == ' ') {
mbrPath.erase(mbrLen-1,1);
@@ -162,10 +162,10 @@ Archive::addFileBefore(const sys::Path& filePath, iterator where) {
mbr->path.getStatusInfo(mbr->info);
unsigned flags = 0;
- bool hasSlash = filePath.get().find('/') != std::string::npos;
+ bool hasSlash = filePath.toString().find('/') != std::string::npos;
if (hasSlash)
flags |= ArchiveMember::HasPathFlag;
- if (hasSlash || filePath.get().length() > 15)
+ if (hasSlash || filePath.toString().length() > 15)
flags |= ArchiveMember::HasLongFilenameFlag;
std::string magic;
mbr->path.getMagicNumber(magic,4);
@@ -212,7 +212,8 @@ Archive::writeMember(
if (CreateSymbolTable &&
(member.isBytecode() || member.isCompressedBytecode())) {
std::vector<std::string> symbols;
- std::string FullMemberName = archPath.get() + "(" + member.getPath().get()
+ std::string FullMemberName = archPath.toString() + "(" +
+ member.getPath().toString()
+ ")";
ModuleProvider* MP = GetBytecodeSymbols(
(const unsigned char*)data,fSize,FullMemberName, symbols);
@@ -235,7 +236,7 @@ Archive::writeMember(
delete MP;
} else {
throw std::string("Can't parse bytecode member: ") +
- member.getPath().get();
+ member.getPath().toString();
}
}
@@ -281,7 +282,8 @@ Archive::writeMember(
// Write the long filename if its long
if (writeLongName) {
- ARFile.write(member.getPath().get().data(),member.getPath().get().length());
+ ARFile.write(member.getPath().toString().data(),
+ member.getPath().toString().length());
}
// Make sure we write the compressed bytecode magic number if we should.
@@ -378,7 +380,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){
// Check for errors opening or creating archive file.
if ( !ArchiveFile.is_open() || ArchiveFile.bad() ) {
- throw std::string("Error opening archive file: ") + archPath.get();
+ throw std::string("Error opening archive file: ") + archPath.toString();
}
// If we're creating a symbol table, reset it now
@@ -414,7 +416,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){
// Open the final file to write and check it.
std::ofstream FinalFile(archPath.c_str());
if ( !FinalFile.is_open() || FinalFile.bad() ) {
- throw std::string("Error opening archive file: ") + archPath.get();
+ throw std::string("Error opening archive file: ") + archPath.toString();
}
// Write the file magic number
diff --git a/lib/Bytecode/Archive/Archive.cpp b/lib/Bytecode/Archive/Archive.cpp
index 8e405907e6..2d79bd66ed 100644
--- a/lib/Bytecode/Archive/Archive.cpp
+++ b/lib/Bytecode/Archive/Archive.cpp
@@ -26,7 +26,7 @@ ArchiveMember::getMemberSize() const {
// If it has a long filename, include the name length
if (hasLongFilename())
- result += path.get().length() + 1;
+ result += path.toString().length() + 1;
// If its now odd lengthed, include the padding byte
if (result % 2 != 0 )
@@ -66,38 +66,38 @@ void ArchiveMember::replaceWith(const sys::Path& newFile) {
path = newFile;
// SVR4 symbol tables have an empty name
- if (path.get() == ARFILE_SVR4_SYMTAB_NAME)
+ if (path.toString() == ARFILE_SVR4_SYMTAB_NAME)
flags |= SVR4SymbolTableFlag;
else
flags &= ~SVR4SymbolTableFlag;
// BSD4.4 symbol tables have a special name
- if (path.get() == ARFILE_BSD4_SYMTAB_NAME)
+ if (path.toString() == ARFILE_BSD4_SYMTAB_NAME)
flags |= BSD4SymbolTableFlag;
else
flags &= ~BSD4SymbolTableFlag;
// LLVM symbol tables have a very specific name
- if (path.get() == ARFILE_LLVM_SYMTAB_NAME)
+ if (path.toString() == ARFILE_LLVM_SYMTAB_NAME)
flags |= LLVMSymbolTableFlag;
else
flags &= ~LLVMSymbolTableFlag;
// String table name
- if (path.get() == ARFILE_STRTAB_NAME)
+ if (path.toString() == ARFILE_STRTAB_NAME)
flags |= StringTableFlag;
else
flags &= ~StringTableFlag;
// If it has a slash then it has a path
- bool hasSlash = path.get().find('/') != std::string::npos;
+ bool hasSlash = path.toString().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.get().length() > 15)
+ if (hasSlash || path.toString().length() > 15)
flags |= HasLongFilenameFlag;
else
flags &= ~HasLongFilenameFlag;
diff --git a/lib/Bytecode/Archive/ArchiveReader.cpp b/lib/Bytecode/Archive/ArchiveReader.cpp
index 34b36a6f38..b00487f0de 100644
--- a/lib/Bytecode/Archive/ArchiveReader.cpp
+++ b/lib/Bytecode/Archive/ArchiveReader.cpp
@@ -295,8 +295,8 @@ Archive::getAllModules(std::vector<Module*>& Modules, std::string* ErrMessage) {
for (iterator I=begin(), E=end(); I != E; ++I) {
if (I->isBytecode() || I->isCompressedBytecode()) {
- std::string FullMemberName = archPath.get() +
- "(" + I->getPath().get() + ")";
+ std::string FullMemberName = archPath.toString() +
+ "(" + I->getPath().toString() + ")";
Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(),
I->getSize(), FullMemberName, ErrMessage);
if (!M)
@@ -407,8 +407,8 @@ Archive::findModuleDefiningSymbol(const std::string& symbol) {
ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size());
// Now, load the bytecode module to get the ModuleProvider
- std::string FullMemberName = archPath.get() + "(" +
- mbr->getPath().get() + ")";
+ std::string FullMemberName = archPath.toString() + "(" +
+ mbr->getPath().toString() + ")";
ModuleProvider* mp = getBytecodeBufferModuleProvider(
(const unsigned char*) mbr->getData(), mbr->getSize(),
FullMemberName, 0);
@@ -446,8 +446,8 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols,
if (mbr->isBytecode() || mbr->isCompressedBytecode()) {
// Get the symbols
std::vector<std::string> symbols;
- std::string FullMemberName = archPath.get() + "(" +
- mbr->getPath().get() + ")";
+ std::string FullMemberName = archPath.toString() + "(" +
+ mbr->getPath().toString() + ")";
ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At,
mbr->getSize(), FullMemberName, symbols);
@@ -462,7 +462,7 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols,
modules.insert(std::make_pair(offset, std::make_pair(MP, mbr)));
} else {
throw std::string("Can't parse bytecode member: ") +
- mbr->getPath().get();
+ mbr->getPath().toString();
}
}
diff --git a/lib/Bytecode/Archive/ArchiveWriter.cpp b/lib/Bytecode/Archive/ArchiveWriter.cpp
index 21be628452..64c256718e 100644
--- a/lib/Bytecode/Archive/ArchiveWriter.cpp
+++ b/lib/Bytecode/Archive/ArchiveWriter.cpp
@@ -94,7 +94,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().get();
+ std::string mbrPath = mbr.getPath().toString();
size_t mbrLen = mbrPath.length();
while (mbrLen > 0 && mbrPath[mbrLen-1] == ' ') {
mbrPath.erase(mbrLen-1,1);
@@ -162,10 +162,10 @@ Archive::addFileBefore(const sys::Path& filePath, iterator where) {
mbr->path.getStatusInfo(mbr->info);
unsigned flags = 0;
- bool hasSlash = filePath.get().find('/') != std::string::npos;
+ bool hasSlash = filePath.toString().find('/') != std::string::npos;
if (hasSlash)
flags |= ArchiveMember::HasPathFlag;
- if (hasSlash || filePath.get().length() > 15)
+ if (hasSlash || filePath.toString().length() > 15)
flags |= ArchiveMember::HasLongFilenameFlag;
std::string magic;
mbr->path.getMagicNumber(magic,4);
@@ -212,7 +212,8 @@ Archive::writeMember(
if (CreateSymbolTable &&
(member.isBytecode() || member.isCompressedBytecode())) {
std::vector<std::string> symbols;
- std::string FullMemberName = archPath.get() + "(" + member.getPath().get()
+ std::string FullMemberName = archPath.toString() + "(" +
+ member.getPath().toString()
+ ")";
ModuleProvider* MP = GetBytecodeSymbols(
(const unsigned char*)data,fSize,FullMemberName, symbols);
@@ -235,7 +236,7 @@ Archive::writeMember(
delete MP;
} else {
throw std::string("Can't parse bytecode member: ") +
- member.getPath().get();
+ member.getPath().toString();
}
}
@@ -281,7 +282,8 @@ Archive::writeMember(
// Write the long filename if its long
if (writeLongName) {
- ARFile.write(member.getPath().get().data(),member.getPath().get().length());
+ ARFile.write(member.getPath().toString().data(),
+ member.getPath().toString().length());
}
// Make sure we write the compressed bytecode magic number if we should.
@@ -378,7 +380,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){
// Check for errors opening or creating archive file.
if ( !ArchiveFile.is_open() || ArchiveFile.bad() ) {
- throw std::string("Error opening archive file: ") + archPath.get();
+ throw std::string("Error opening archive file: ") + archPath.toString();
}
// If we're creating a symbol table, reset it now
@@ -414,7 +416,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){
// Open the final file to write and check it.
std::ofstream FinalFile(archPath.c_str());
if ( !FinalFile.is_open() || FinalFile.bad() ) {
- throw std::string("Error opening archive file: ") + archPath.get();
+ throw std::string("Error opening archive file: ") + archPath.toString();
}
// Write the file magic number
diff --git a/lib/Bytecode/Reader/ReaderWrappers.cpp b/lib/Bytecode/Reader/ReaderWrappers.cpp
index b8c8b4adb7..fccbbe74fb 100644
--- a/lib/Bytecode/Reader/ReaderWrappers.cpp
+++ b/lib/Bytecode/Reader/ReaderWrappers.cpp
@@ -374,7 +374,8 @@ void getSymbols(Module*M, std::vector<std::string>& symbols) {
bool llvm::GetBytecodeSymbols(const sys::Path& fName,
std::vector<std::string>& symbols) {
try {
- std::auto_ptr<ModuleProvider> AMP( getBytecodeModuleProvider(fName.get()));
+ std::auto_ptr<ModuleProvider> AMP(
+ getBytecodeModuleProvider(fName.toString()));
// Get the module from the provider
Module* M = AMP->materializeModule();
diff --git a/lib/System/Unix/MappedFile.cpp b/lib/System/Unix/MappedFile.cpp
index 0e03a04c6f..1c9622d362 100644
--- a/lib/System/Unix/MappedFile.cpp
+++ b/lib/System/Unix/MappedFile.cpp
@@ -44,17 +44,17 @@ void MappedFile::initialize() {
if (info_->fd_ < 0) {
delete info_;
info_ = 0;
- ThrowErrno(std::string("Can't open file: ") + path_.get());
+ ThrowErrno(std::string("Can't open file: ") + path_.toString());
}
struct stat sbuf;
if(::fstat(info_->fd_, &info_->sbuf_) < 0) {
::close(info_->fd_);
delete info_;
info_ = 0;
- ThrowErrno(std::string("Can't stat file: ") + path_.get());
+ ThrowErrno(std::string("Can't stat file: ") + path_.toString());
}
} else {
- throw std::string("Can't open file: ") + path_.get();
+ throw std::string("Can't open file: ") + path_.toString();
}
}
@@ -103,7 +103,7 @@ void* MappedFile::map() {
base_ = ::mmap(0, map_size, prot, flags, info_->fd_, 0);
if (base_ == MAP_FAILED)
- ThrowErrno(std::string("Can't map file:") + path_.get());
+ ThrowErrno(std::string("Can't map file:") + path_.toString());
}
return base_;
}
diff --git a/lib/System/Unix/MappedFile.inc b/lib/System/Unix/MappedFile.inc
index 0e03a04c6f..1c9622d362 100644
--- a/lib/System/Unix/MappedFile.inc
+++ b/lib/System/Unix/MappedFile.inc
@@ -44,17 +44,17 @@ void MappedFile::initialize() {
if (info_->fd_ < 0) {
delete info_;
info_ = 0;
- ThrowErrno(std::string("Can't open file: ") + path_.get());
+ ThrowErrno(std::string("Can't open file: ") + path_.toString());
}
struct stat sbuf;
if(::fstat(info_->fd_, &info_->sbuf_) < 0) {
::close(info_->fd_);
delete info_;
info_ = 0;
- ThrowErrno(std::string("Can't stat file: ") + path_.get());
+ ThrowErrno(std::string("Can't stat file: ") + path_.toString());
}
} else {
- throw std::string("Can't open file: ") + path_.get();
+ throw std::string("Can't open file: ") + path_.toString();
}
}
@@ -103,7 +103,7 @@ void* MappedFile::map() {
base_ = ::mmap(0, map_size, prot, flags, info_->fd_, 0);
if (base_ == MAP_FAILED)
- ThrowErrno(std::string("Can't map file:") + path_.get());
+ ThrowErrno(std::string("Can't map file:") + path_.toString());
}
return base_;
}
diff --git a/lib/System/Unix/Path.cpp b/lib/System/Unix/Path.cpp
index 5d2a4b688c..d3e4d96a83 100644
--- a/lib/System/Unix/Path.cpp
+++ b/lib/System/Unix/Path.cpp
@@ -21,7 +21,6 @@
#include "Unix.h"
#include <sys/stat.h>
#include <fcntl.h>
-#include <fstream>
#include <utime.h>
#include <dirent.h>
@@ -192,10 +191,13 @@ bool
Path::isBytecodeFile() const {
char buffer[ 4];
buffer[0] = 0;
- std::ifstream f(path.c_str());
- f.read(buffer, 4);
- if (f.bad())
- ThrowErrno("can't read file signature");
+ int fd = ::open(path.c_str(),O_RDONLY);
+ if (fd < 0)
+ return false;
+ ssize_t bytes_read = ::read(fd, buffer, 4);
+ ::close(fd);
+ if (4 != bytes_read)
+ return false;
return (buffer[0] == 'l' && buffer[1] == 'l' && buffer[2] == 'v' &&
(buffer[3] == 'c' || buffer[3] == 'm'));
@@ -522,7 +524,8 @@ bool
Path::renameFile(const Path& newName) {
if (!isFile()) return false;
if (0 != rename(path.c_str(), newName.c_str()))
- ThrowErrno(std::string("can't rename ") + path + " as " + newName.get());
+ ThrowErrno(std::string("can't rename ") + path + " as " +
+ newName.toString());
return true;
}
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index 5d2a4b688c..d3e4d96a83 100644
--- a/lib/System/Unix/Path.inc
+++ b/lib/System/Unix/Path.inc
@@ -21,7 +21,6 @@
#include "Unix.h"
#include <sys/stat.h>
#include <fcntl.h>
-#include <fstream>
#include <utime.h>
#include <dirent.h>
@@ -192,10 +191,13 @@ bool
Path::isBytecodeFile() const {
char buffer[ 4];
buffer[0] = 0;
- std::ifstream f(path.c_str());
- f.read(buffer, 4);
- if (f.bad())
- ThrowErrno("can't read file signature");
+ int fd = ::open(path.c_str(),O_RDONLY);
+ if (fd < 0)
+ return false;
+ ssize_t bytes_read = ::read(fd, buffer, 4);
+ ::close(fd);
+ if (4 != bytes_read)
+ return false;
return (buffer[0] == 'l' && buffer[1] == 'l' && buffer[2] == 'v' &&
(buffer[3] == 'c' || buffer[3] == 'm'));
@@ -522,7 +524,8 @@ bool
Path::renameFile(const Path& newName) {
if (!isFile()) return false;
if (0 != rename(path.c_str(), newName.c_str()))
- ThrowErrno(std::string("can't rename ") + path + " as " + newName.get());
+ ThrowErrno(std::string("can't rename ") + path + " as " +
+ newName.toString());
return true;
}
diff --git a/lib/System/Unix/Program.cpp b/lib/System/Unix/Program.cpp
index 18fcafeb4e..ae53720d1d 100644
--- a/lib/System/Unix/Program.cpp
+++ b/lib/System/Unix/Program.cpp
@@ -81,7 +81,7 @@ int
Program::ExecuteAndWait(const Path& path,
const std::vector<std::string>& args) {
if (!path.executable())
- throw path.get() + " is not executable";
+ throw path.toString() + " is not executable";
#ifdef HAVE_SYS_WAIT_H
// Create local versions of the parameters that can be passed into execve()
@@ -98,7 +98,8 @@ Program::ExecuteAndWait(const Path& path,
switch (fork()) {
// An error occured: Return to the caller.
case -1:
- ThrowErrno(std::string("Couldn't execute program '") + path.get() + "'");
+ ThrowErrno(std::string("Couldn't execute program '") + path.toString() +
+ "'");
break;
// Child process: Execute the program.
@@ -116,13 +117,15 @@ Program::ExecuteAndWait(const Path& path,
// Parent process: Wait for the child process to terminate.
int status;
if ((::wait (&status)) == -1)
- ThrowErrno(std::string("Failed waiting for program '") + path.get() + "'");
+ ThrowErrno(std::string("Failed waiting for program '") + path.toString()
+ + "'");
// If the program exited normally with a zero exit status, return success!
if (WIFEXITED (status))
return WEXITSTATUS(status);
else if (WIFSIGNALED(status))
- throw std::string("Program '") + path.get() + "' received terminating signal.";
+ throw std::string("Program '") + path.toString() +
+ "' received terminating signal.";
else
return 0;
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc
index 18fcafeb4e..ae53720d1d 100644
--- a/lib/System/Unix/Program.inc
+++ b/lib/System/Unix/Program.inc
@@ -81,7 +81,7 @@ int
Program::ExecuteAndWait(const Path& path,
const std::vector<std::string>& args) {
if (!path.executable())
- throw path.get() + " is not executable";
+ throw path.toString() + " is not executable";
#ifdef HAVE_SYS_WAIT_H
// Create local versions of the parameters that can be passed into execve()
@@ -98,7 +98,8 @@ Program::ExecuteAndWait(const Path& path,
switch (fork()) {
// An error occured: Return to the caller.
case -1:
- ThrowErrno(std::string("Couldn't execute program '") + path.get() + "'");
+ ThrowErrno(std::string("Couldn't execute program '") + path.toString() +
+ "'");
break;
// Child process: Execute the program.
@@ -116,13 +117,15 @@ Program::ExecuteAndWait(const Path& path,
// Parent process: Wait for the child process to terminate.
int status;
if ((::wait (&status)) == -1)
- ThrowErrno(std::string("Failed waiting for program '") + path.get() + "'");
+ ThrowErrno(std::string("Failed waiting for program '") + path.toString()
+ + "'");
// If the program exited normally with a zero exit status, return success!
if (WIFEXITED (status))
return WEXITSTATUS(status);
else if (WIFSIGNALED(status))
- throw std::string("Program '") + path.get() + "' received terminating signal.";
+ throw std::string("Program '") + path.toString() +
+ "' received terminating signal.";
else
return 0;
diff --git a/lib/System/Unix/Signals.cpp b/lib/System/Unix/Signals.cpp
index 88e87666de..8a3eee1343 100644
--- a/lib/System/Unix/Signals.cpp
+++ b/lib/System/Unix/Signals.cpp
@@ -138,7 +138,7 @@ void sys::RemoveFileOnSignal(const sys::Path &Filename) {
if (FilesToRemove == 0)
FilesToRemove = new std::vector<std::string>;
- FilesToRemove->push_back(Filename.get());
+ FilesToRemove->push_back(Filename.toString());
std::for_each(IntSigs, IntSigsEnd, RegisterHandler);
std::for_each(KillSigs, KillSigsEnd, RegisterHandler);
diff --git a/lib/System/Unix/Signals.inc b/lib/System/Unix/Signals.inc
index 88e87666de..8a3eee1343 100644
--- a/lib/System/Unix/Signals.inc
+++ b/lib/System/Unix/Signals.inc
@@ -138,7 +138,7 @@ void sys::RemoveFileOnSignal(const sys::Path &Filename) {
if (FilesToRemove == 0)
FilesToRemove = new std::vector<std::string>;
- FilesToRemove->push_back(Filename.get());
+ FilesToRemove->push_back(Filename.toString());
std::for_each(IntSigs, IntSigsEnd, RegisterHandler);
std::for_each(KillSigs, KillSigsEnd, RegisterHandler);
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index 2a9b4717d0..1d75becf03 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -345,7 +345,7 @@ void doPrint() {
continue;
if (Verbose)
- std::cout << "Printing " << I->getPath().get() << "\n";
+ std::cout << "Printing " << I->getPath().toString() << "\n";
if (I->isCompressedBytecode())
Compressor::decompressToStream(data+4,I->getSize()-4,std::cout);
@@ -409,9 +409,9 @@ void doDisplayTable() {
std::cout << " " << std::setw(8) << I->getSize();
std::cout << " " << std::setw(20) <<
I->getModTime().toString().substr(4);
- std::cout << " " << I->getPath().get() << "\n";
+ std::cout << " " << I->getPath().toString() << "\n";
} else {
- std::cout << I->getPath().get() << "\n";
+ std::cout << I->getPath().toString() << "\n";
}
}
}
@@ -505,7 +505,7 @@ void doMove() {
if (AddBefore || InsertBefore || AddAfter) {
for (Archive::iterator I = TheArchive->begin(), E= TheArchive->end();
I != E; ++I ) {
- if (RelPos == I->getPath().get()) {
+ if (RelPos == I->getPath().toString()) {
if (AddAfter) {
moveto_spot = I;
moveto_spot++;
@@ -582,7 +582,7 @@ void doReplaceOrInsert() {
std::set<sys::Path>::iterator found = remaining.end();
for (std::set<sys::Path>::iterator RI = remaining.begin(),
RE = remaining.end(); RI != RE; ++RI ) {
- std::string compare(RI->get());
+ std::string compare(RI->toString());
if (TruncateNames && compare.length() > 15) {
const char* nm = compare.c_str();
unsigned len = compare.length();
@@ -595,7 +595,7 @@ void doReplaceOrInsert() {
len = 15;
compare.assign(nm,len);
}
- if (compare == I->getPath().get()) {
+ if (compare == I->getPath().toString()) {
found = RI;
break;
}
@@ -622,9 +622,9 @@ void doReplaceOrInsert() {
}
// Determine if this is the place where we should insert
- if ((AddBefore || InsertBefore) && (RelPos == I->getPath().get()))
+ if ((AddBefore || InsertBefore) && (RelPos == I->getPath().toString()))
insert_spot = I;
- else if (AddAfter && (RelPos == I->getPath().get())) {
+ else if (AddAfter && (RelPos == I->getPath().toString())) {
insert_spot = I;
insert_spot++;
}
@@ -675,7 +675,7 @@ int main(int argc, char **argv) {
if (!ArchivePath.exists()) {
// Produce a warning if we should and we're creating the archive
if (!Create)
- std::cerr << argv[0] << ": creating " << ArchivePath.get() << "\n";
+ std::cerr << argv[0] << ": creating " << ArchivePath.toString() << "\n";
TheArchive = Archive::CreateEmpty(ArchivePath);
} else {
TheArchive = Archive::OpenAndLoad(ArchivePath);
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 07ce76203b..1fcbf336e6 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/