use an autoptr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17875 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-11-16 06:40:54 +00:00
parent 90c18c5c69
commit a4d0c6fb94

View File

@ -195,18 +195,14 @@ bool llvm::LinkInArchive(Module *M,
for (std::set<ModuleProvider*>::iterator I=Modules.begin(), E=Modules.end();
I != E; ++I) {
// Get the module we must link in.
Module* aModule = (*I)->releaseModule();
std::auto_ptr<Module> aModule((*I)->releaseModule());
// Link it in
if (LinkModules(M, aModule, ErrorMessage)) {
// Link it in.
if (LinkModules(M, aModule.get(), ErrorMessage)) {
// don't create a memory leak
delete aModule;
delete arch;
return true; // Couldn't link in the right object file...
}
// Since we have linked in this object, throw it away now.
delete aModule;
}
// We have linked in a set of modules determined by the archive to satisfy