summaryrefslogtreecommitdiff
path: root/lib/Archive
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 22:45:37 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 22:45:37 +0000
commit74382b7c699120fbec5cb5603c9cf4212eb37f06 (patch)
treec8c2c5b8879b256c428b0d35841b9cce1c2cc51c /lib/Archive
parent983c592272eb59d39fd78c515e1f2701638879e0 (diff)
downloadllvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.gz
llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.bz2
llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.xz
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/Archive')
-rw-r--r--lib/Archive/Archive.cpp16
-rw-r--r--lib/Archive/ArchiveReader.cpp16
-rw-r--r--lib/Archive/ArchiveWriter.cpp19
3 files changed, 25 insertions, 26 deletions
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;
}