Simplify code.

We can delete the objects earlier now that we are copying the names to a buffer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211221 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-06-18 21:08:17 +00:00
parent 889069443b
commit d8fc64e0d1

View File

@ -692,7 +692,6 @@ static void writeSymbolTable(
std::string NameBuf;
raw_string_ostream NameOS(NameBuf);
unsigned NumSyms = 0;
std::vector<object::SymbolicFile *> DeleteIt;
LLVMContext &Context = getGlobalContext();
for (ArrayRef<NewArchiveIterator>::iterator I = Members.begin(),
E = Members.end();
@ -703,9 +702,8 @@ static void writeSymbolTable(
MemberBuffer, false, sys::fs::file_magic::unknown, &Context);
if (!ObjOrErr)
continue; // FIXME: check only for "not an object file" errors.
object::SymbolicFile *Obj = ObjOrErr.get();
std::unique_ptr<object::SymbolicFile> Obj(ObjOrErr.get());
DeleteIt.push_back(Obj);
if (!StartOffset) {
printMemberHeader(Out, "", sys::TimeValue::now(), 0, 0, 0, 0);
StartOffset = Out.tell();
@ -731,13 +729,6 @@ static void writeSymbolTable(
}
Out << NameOS.str();
for (std::vector<object::SymbolicFile *>::iterator I = DeleteIt.begin(),
E = DeleteIt.end();
I != E; ++I) {
object::SymbolicFile *O = *I;
delete O;
}
if (StartOffset == 0)
return;