-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
// and to handle annoying things like static libraries.
//
//===----------------------------------------------------------------------===//
// and to handle annoying things like static libraries.
//
//===----------------------------------------------------------------------===//
assert(!I->hasDLLImportLinkage()
&& "Found dllimported non-external symbol!");
DefinedSymbols.insert(I->getName());
}
}
assert(!I->hasDLLImportLinkage()
&& "Found dllimported non-external symbol!");
DefinedSymbols.insert(I->getName());
}
}
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I)
if (I->hasName()) {
if (I->isDeclaration())
UndefinedSymbols.insert(I->getName());
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I)
if (I->hasName()) {
if (I->isDeclaration())
UndefinedSymbols.insert(I->getName());
assert(!I->hasDLLImportLinkage()
&& "Found dllimported non-external symbol!");
DefinedSymbols.insert(I->getName());
}
}
assert(!I->hasDLLImportLinkage()
&& "Found dllimported non-external symbol!");
DefinedSymbols.insert(I->getName());
}
}
// Prune out any defined symbols from the undefined symbols set...
for (std::set<std::string>::iterator I = UndefinedSymbols.begin();
I != UndefinedSymbols.end(); )
// Prune out any defined symbols from the undefined symbols set...
for (std::set<std::string>::iterator I = UndefinedSymbols.begin();
I != UndefinedSymbols.end(); )
// Make sure this is an archive file we're dealing with
if (!Filename.isArchive())
return error("File '" + Filename.toString() + "' is not an archive.");
// Make sure this is an archive file we're dealing with
if (!Filename.isArchive())
return error("File '" + Filename.toString() + "' is not an archive.");
// If all the symbols are defined, the program is complete, and there is
// no reason to link in any archive files.
std::set<std::string> UndefinedSymbols;
// If all the symbols are defined, the program is complete, and there is
// no reason to link in any archive files.
std::set<std::string> UndefinedSymbols;
// Save a set of symbols that are not defined by the archive. Since we're
// entering a loop, there's no point searching for these multiple times. This
// Save a set of symbols that are not defined by the archive. Since we're
// entering a loop, there's no point searching for these multiple times. This
// Get the module we must link in.
std::string moduleErrorMsg;
std::auto_ptr<Module> AutoModule((*I)->releaseModule( &moduleErrorMsg ));
// Get the module we must link in.
std::string moduleErrorMsg;
std::auto_ptr<Module> AutoModule((*I)->releaseModule( &moduleErrorMsg ));