Do not use temporary variables to pass them to forEachUndefines.

So that it's obvious that we pass these callbacks only to forEachUndefines.

llvm-svn: 205593
This commit is contained in:
Rui Ueyama 2014-04-04 00:39:37 +00:00
parent 7247546ba3
commit 0b8e053ebd
2 changed files with 14 additions and 15 deletions

View File

@ -65,7 +65,7 @@ private:
bool checkUndefines();
void removeCoalescedAwayAtoms();
void checkDylibSymbolCollisions();
void forEachUndefines(UndefCallback callback, bool searchForOverrides);
void forEachUndefines(bool searchForOverrides, UndefCallback callback);
void markLive(const Atom &atom);
void addAtoms(const std::vector<const DefinedAtom *>&);

View File

@ -68,8 +68,8 @@ void Resolver::handleFile(const File &file) {
_context.getInputGraph().notifyProgress();
}
void Resolver::forEachUndefines(UndefCallback callback,
bool searchForOverrides) {
void Resolver::forEachUndefines(bool searchForOverrides,
UndefCallback callback) {
// Handle normal archives
int64_t undefineGenCount = 0;
do {
@ -99,30 +99,29 @@ void Resolver::forEachUndefines(UndefCallback callback,
void Resolver::handleArchiveFile(const File &file) {
const ArchiveLibraryFile *archiveFile = cast<ArchiveLibraryFile>(&file);
auto callback = [&](StringRef undefName, bool dataSymbolOnly) {
bool searchForOverrides =
_context.searchArchivesToOverrideTentativeDefinitions();
forEachUndefines(searchForOverrides,
[&](StringRef undefName, bool dataSymbolOnly) {
if (const File *member = archiveFile->find(undefName, dataSymbolOnly)) {
member->setOrdinal(_context.getNextOrdinalAndIncrement());
handleFile(*member);
}
};
bool searchForOverrides =
_context.searchArchivesToOverrideTentativeDefinitions();
forEachUndefines(callback, searchForOverrides);
});
}
void Resolver::handleSharedLibrary(const File &file) {
// Add all the atoms from the shared library
const SharedLibraryFile *sharedLibrary = cast<SharedLibraryFile>(&file);
handleFile(*sharedLibrary);
auto callback = [&](StringRef undefName, bool dataSymbolOnly) {
if (const SharedLibraryAtom *shAtom =
sharedLibrary->exports(undefName, dataSymbolOnly))
doSharedLibraryAtom(*shAtom);
};
bool searchForOverrides =
_context.searchSharedLibrariesToOverrideTentativeDefinitions();
forEachUndefines(callback, searchForOverrides);
forEachUndefines(searchForOverrides,
[&](StringRef undefName, bool dataSymbolOnly) {
if (const SharedLibraryAtom *atom =
sharedLibrary->exports(undefName, dataSymbolOnly))
doSharedLibraryAtom(*atom);
});
}
void Resolver::doUndefinedAtom(const UndefinedAtom &atom) {