Propagate Resolver::resolveUndefines()'s failure to caller.

llvm-svn: 192424
This commit is contained in:
Rui Ueyama 2013-10-11 06:26:16 +00:00
parent f1e266846d
commit 2ad117db97
2 changed files with 8 additions and 7 deletions

View File

@ -69,7 +69,7 @@ public:
private:
/// \brief The main function that iterates over the files to resolve
void resolveUndefines();
bool resolveUndefines();
void updateReferences();
void deadStripOptimize();
bool checkUndefines(bool final);

View File

@ -289,20 +289,20 @@ void Resolver::addAtoms(const std::vector<const DefinedAtom*>& newAtoms) {
}
}
// Ask symbol table if any undefined atoms still exist. If so, keep searching
// libraries until no more atoms being added.
void Resolver::resolveUndefines() {
// Keep adding atoms until _context.nextFile() returns an error. This function
// is where undefined atoms are resolved.
bool Resolver::resolveUndefines() {
ScopedTask task(getDefaultDomain(), "resolveUndefines");
for (;;) {
ErrorOr<File &> file = _context.nextFile();
_context.setResolverState(Resolver::StateNoChange);
if (error_code(file) == InputGraphError::no_more_files)
return;
return true;
if (!file) {
llvm::errs() << "Error occurred in nextFile: "
<< error_code(file).message() << "\n";
return;
return false;
}
switch (file->kind()) {
@ -470,7 +470,8 @@ void Resolver::linkTimeOptimize() {
}
bool Resolver::resolve() {
this->resolveUndefines();
if (!this->resolveUndefines())
return false;
this->updateReferences();
this->deadStripOptimize();
if (this->checkUndefines(false)) {