For new archive member we only need to store the full path.

We were storing both the path and the file name, which was redundant
and easy to get confused up with.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242347 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-07-15 22:46:53 +00:00
parent c2fa6d64b4
commit ba7661d294
4 changed files with 13 additions and 18 deletions

View File

@ -38,8 +38,8 @@ NewArchiveIterator::NewArchiveIterator(object::Archive::child_iterator I,
StringRef Name)
: IsNewMember(false), Name(Name), OldI(I) {}
NewArchiveIterator::NewArchiveIterator(StringRef NewFilename, StringRef Name)
: IsNewMember(true), Name(Name), NewFilename(NewFilename) {}
NewArchiveIterator::NewArchiveIterator(StringRef FileName)
: IsNewMember(true), Name(FileName) {}
StringRef NewArchiveIterator::getName() const { return Name; }
@ -52,14 +52,14 @@ object::Archive::child_iterator NewArchiveIterator::getOld() const {
StringRef NewArchiveIterator::getNew() const {
assert(IsNewMember);
return NewFilename;
return Name;
}
llvm::ErrorOr<int>
NewArchiveIterator::getFD(sys::fs::file_status &NewStatus) const {
assert(IsNewMember);
int NewFD;
if (auto EC = sys::fs::openFileForRead(NewFilename, NewFD))
if (auto EC = sys::fs::openFileForRead(Name, NewFD))
return EC;
assert(NewFD != -1);