llvm.org GIT mirror llvm / 25569fd
Use Child instead of child_iterator in the archive writer. We never need to pass end(). This will also remove some complication once we start adding error checking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251758 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 3 years ago
3 changed file(s) with 11 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
2323 bool IsNewMember;
2424 StringRef Name;
2525
26 object::Archive::child_iterator OldI;
26 object::Archive::Child OldMember;
2727
2828 public:
29 NewArchiveIterator(object::Archive::child_iterator I, StringRef Name);
29 NewArchiveIterator(const object::Archive::Child &OldMember, StringRef Name);
3030 NewArchiveIterator(StringRef FileName);
3131 bool isNewMember() const;
3232 StringRef getName() const;
3333
34 object::Archive::child_iterator getOld() const;
34 const object::Archive::Child &getOld() const;
3535
3636 StringRef getNew() const;
3737 llvm::ErrorOr getFD(sys::fs::file_status &NewStatus) const;
3333
3434 using namespace llvm;
3535
36 NewArchiveIterator::NewArchiveIterator(object::Archive::child_iterator I,
36 NewArchiveIterator::NewArchiveIterator(const object::Archive::Child &OldMember,
3737 StringRef Name)
38 : IsNewMember(false), Name(Name), OldI(I) {}
38 : IsNewMember(false), Name(Name), OldMember(OldMember) {}
3939
4040 NewArchiveIterator::NewArchiveIterator(StringRef FileName)
41 : IsNewMember(true), Name(FileName) {}
41 : IsNewMember(true), Name(FileName), OldMember(nullptr, nullptr) {}
4242
4343 StringRef NewArchiveIterator::getName() const { return Name; }
4444
4545 bool NewArchiveIterator::isNewMember() const { return IsNewMember; }
4646
47 object::Archive::child_iterator NewArchiveIterator::getOld() const {
47 const object::Archive::Child &NewArchiveIterator::getOld() const {
4848 assert(!IsNewMember);
49 return OldI;
49 return OldMember;
5050 }
5151
5252 StringRef NewArchiveIterator::getNew() const {
445445 }
446446
447447 void addMember(std::vector &Members,
448 object::Archive::child_iterator I, StringRef Name,
449 int Pos = -1) {
450 if (Thin && !I->getParent()->isThin())
448 const object::Archive::Child &M, StringRef Name, int Pos = -1) {
449 if (Thin && !M.getParent()->isThin())
451450 fail("Cannot convert a regular archive to a thin one");
452 NewArchiveIterator NI(I, Name);
451 NewArchiveIterator NI(M, Name);
453452 if (Pos == -1)
454453 Members.push_back(NI);
455454 else