//===----------------------------------------------------------------------===//
#include "ArchiveInternals.h"
-#include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/Module.h"
#include "llvm/ADT/OwningPtr.h"
+#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/System/Signals.h"
#include "llvm/System/Process.h"
-#include "llvm/ModuleProvider.h"
+#include "llvm/System/Signals.h"
#include <fstream>
#include <ostream>
#include <iomanip>
}
// Create an empty archive.
-Archive* Archive::CreateEmpty(const sys::Path& FilePath, const LLVMContext& C) {
+Archive* Archive::CreateEmpty(const sys::Path& FilePath, LLVMContext& C) {
Archive* result = new Archive(FilePath, C);
return result;
}
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);
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);
// 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 =
+ Module* M =
GetBitcodeSymbols((const unsigned char*)data,fSize,
FullMemberName, Context, symbols, ErrMsg);
// If the bitcode parsed successfully
- if ( MP ) {
+ if ( M ) {
for (std::vector<std::string>::iterator SI = symbols.begin(),
SE = symbols.end(); SI != SE; ++SI) {
}
}
// We don't need this module any more.
- delete MP;
+ delete M;
} 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;
}
// 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.
if (TmpArchive.exists())
TmpArchive.eraseFromDisk();
if (ErrMsg)
- *ErrMsg = "Error opening archive file: " + archPath.toString();
+ *ErrMsg = "Error opening archive file: " + archPath.str();
return true;
}
if (TmpArchive.exists())
TmpArchive.eraseFromDisk();
if (ErrMsg)
- *ErrMsg = "Error opening archive file: " + FinalFilePath.toString();
+ *ErrMsg = "Error opening archive file: " + FinalFilePath.str();
return true;
}