summaryrefslogtreecommitdiff
path: root/tools/llvm-ar/ArchiveWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-19 17:49:07 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-19 17:49:07 +0000
commit13f4fd77b96c39b3836d1186953003ddfea3a646 (patch)
tree396bcbceb7026ab327bffc56d5abf77f2fbf72be /tools/llvm-ar/ArchiveWriter.cpp
parent80a6d6526c4ea4de90327c1404e2689a260a9fee (diff)
downloadllvm-13f4fd77b96c39b3836d1186953003ddfea3a646.tar.gz
llvm-13f4fd77b96c39b3836d1186953003ddfea3a646.tar.bz2
llvm-13f4fd77b96c39b3836d1186953003ddfea3a646.tar.xz
Remove more uses of sys::Path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184328 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-ar/ArchiveWriter.cpp')
-rw-r--r--tools/llvm-ar/ArchiveWriter.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/tools/llvm-ar/ArchiveWriter.cpp b/tools/llvm-ar/ArchiveWriter.cpp
index 16e748469f..7b5574e0a2 100644
--- a/tools/llvm-ar/ArchiveWriter.cpp
+++ b/tools/llvm-ar/ArchiveWriter.cpp
@@ -67,7 +67,7 @@ static inline unsigned numVbrBytes(unsigned num) {
}
// Create an empty archive.
-Archive* Archive::CreateEmpty(const sys::Path& FilePath, LLVMContext& C) {
+Archive* Archive::CreateEmpty(StringRef FilePath, LLVMContext& C) {
Archive* result = new Archive(FilePath, C);
return result;
}
@@ -153,9 +153,8 @@ Archive::fillHeader(const ArchiveMember &mbr, ArchiveMemberHeader& hdr,
// Insert a file into the archive before some other member. This also takes care
// of extracting the necessary flags and information from the file.
-bool
-Archive::addFileBefore(const sys::Path& filePath, iterator where,
- std::string* ErrMsg) {
+bool Archive::addFileBefore(StringRef filePath, iterator where,
+ std::string *ErrMsg) {
bool Exists;
if (sys::fs::exists(filePath.str(), Exists) || !Exists) {
if (ErrMsg)
@@ -231,8 +230,8 @@ Archive::writeMember(
// symbol table if it's a bitcode file.
if (CreateSymbolTable && member.isBitcode()) {
std::vector<std::string> symbols;
- std::string FullMemberName = archPath.str() + "(" + member.getPath().str()
- + ")";
+ std::string FullMemberName =
+ (archPath + "(" + member.getPath() + ")").str();
Module* M =
GetBitcodeSymbols(data, fSize, FullMemberName, Context, symbols, ErrMsg);
@@ -305,7 +304,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames,
}
// Create a temporary file to store the archive in
- sys::Path TmpArchive = archPath;
+ sys::Path TmpArchive(archPath);
if (TmpArchive.createTemporaryFileOnDisk(ErrMsg))
return true;
@@ -321,7 +320,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames,
if (!ArchiveFile.is_open() || ArchiveFile.bad()) {
TmpArchive.eraseFromDisk();
if (ErrMsg)
- *ErrMsg = "Error opening archive file: " + archPath.str();
+ *ErrMsg = "Error opening archive file: " + archPath;
return true;
}
@@ -355,7 +354,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames,
// ensure compatibility with other archivers we need to put the symbol
// table first in the file. Unfortunately, this means mapping the file
// we just wrote back in and copying it to the destination file.
- sys::Path FinalFilePath = archPath;
+ sys::Path FinalFilePath(archPath);
// Map in the archive we just wrote.
{
@@ -416,14 +415,14 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames,
// this because we cannot replace an open file on Windows.
cleanUpMemory();
- if (TmpArchive.renamePathOnDisk(archPath, ErrMsg))
+ if (TmpArchive.renamePathOnDisk(sys::Path(archPath), ErrMsg))
return true;
// Set correct read and write permissions after temporary file is moved
// to final destination path.
- if (archPath.makeReadableOnDisk(ErrMsg))
+ if (sys::Path(archPath).makeReadableOnDisk(ErrMsg))
return true;
- if (archPath.makeWriteableOnDisk(ErrMsg))
+ if (sys::Path(archPath).makeWriteableOnDisk(ErrMsg))
return true;
return false;