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
bool IsNewMember;
StringRef Name;
- object::Archive::child_iterator OldI;
+ object::Archive::Child OldMember;
public:
- NewArchiveIterator(object::Archive::child_iterator I, StringRef Name);
+ NewArchiveIterator(const object::Archive::Child &OldMember, StringRef Name);
NewArchiveIterator(StringRef FileName);
bool isNewMember() const;
StringRef getName() const;
- object::Archive::child_iterator getOld() const;
+ const object::Archive::Child &getOld() const;
StringRef getNew() const;
llvm::ErrorOr<int> getFD(sys::fs::file_status &NewStatus) const;
using namespace llvm;
-NewArchiveIterator::NewArchiveIterator(object::Archive::child_iterator I,
+NewArchiveIterator::NewArchiveIterator(const object::Archive::Child &OldMember,
StringRef Name)
- : IsNewMember(false), Name(Name), OldI(I) {}
+ : IsNewMember(false), Name(Name), OldMember(OldMember) {}
NewArchiveIterator::NewArchiveIterator(StringRef FileName)
- : IsNewMember(true), Name(FileName) {}
+ : IsNewMember(true), Name(FileName), OldMember(nullptr, nullptr) {}
StringRef NewArchiveIterator::getName() const { return Name; }
bool NewArchiveIterator::isNewMember() const { return IsNewMember; }
-object::Archive::child_iterator NewArchiveIterator::getOld() const {
+const object::Archive::Child &NewArchiveIterator::getOld() const {
assert(!IsNewMember);
- return OldI;
+ return OldMember;
}
StringRef NewArchiveIterator::getNew() const {
}
void addMember(std::vector<NewArchiveIterator> &Members,
- object::Archive::child_iterator I, StringRef Name,
- int Pos = -1) {
- if (Thin && !I->getParent()->isThin())
+ const object::Archive::Child &M, StringRef Name, int Pos = -1) {
+ if (Thin && !M.getParent()->isThin())
fail("Cannot convert a regular archive to a thin one");
- NewArchiveIterator NI(I, Name);
+ NewArchiveIterator NI(M, Name);
if (Pos == -1)
Members.push_back(NI);
else