/// object. There are four kinds of Atoms, so this iterator is templated on
/// the four base Atom kinds.
template <typename T>
- class atom_iterator {
+ class atom_iterator : public std::iterator<std::forward_iterator_tag, T> {
public:
atom_iterator(const atom_collection<T> &c, const void *it)
: _collection(c), _it(it) { }
return _collection.deref(_it);
}
- bool operator!=(const atom_iterator<T> &other) const {
- return (this->_it != other._it);
+ friend bool operator==(const atom_iterator<T> &lhs, const atom_iterator<T> &rhs) {
+ return lhs._it == rhs._it;
+ }
+
+ friend bool operator!=(const atom_iterator<T> &lhs, const atom_iterator<T> &rhs) {
+ return !(lhs == rhs);
}
atom_iterator<T> &operator++() {
const void *_it;
};
-
/// \brief Must be implemented to return the atom_collection object for
/// all DefinedAtoms in this File.
virtual const atom_collection<DefinedAtom> &defined() const = 0;
mergedFile->addAtom(*helperCacheNLPAtom);
// Add reference to dyld_stub_binder in libSystem.dylib
- bool binderFound = false;
- for (const SharedLibraryAtom *atom : mergedFile->sharedLibrary()) {
- if (atom->name().equals(_stubInfo.binderSymbolName)) {
- addReference(helperBinderNLPAtom,
- _stubInfo.nonLazyPointerReferenceToBinder, atom);
- binderFound = true;
- break;
- }
- }
- assert(binderFound && "dyld_stub_binder not found");
- (void)binderFound;
+ auto I = std::find_if(
+ mergedFile->sharedLibrary().begin(), mergedFile->sharedLibrary().end(),
+ [&](const SharedLibraryAtom *atom) {
+ return atom->name().equals(_stubInfo.binderSymbolName);
+ });
+ assert(I != mergedFile->sharedLibrary().end() && "dyld_stub_binder not found");
+ addReference(helperBinderNLPAtom, _stubInfo.nonLazyPointerReferenceToBinder, *I);
// Sort targets by name, so stubs and lazy pointers are consistent
std::vector<const Atom *> targetsNeedingStubs;