[llvm] r211221 - Simplify code.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jun 18 14:08:17 PDT 2014
Author: rafael
Date: Wed Jun 18 16:08:17 2014
New Revision: 211221
URL: http://llvm.org/viewvc/llvm-project?rev=211221&view=rev
Log:
Simplify code.
We can delete the objects earlier now that we are copying the names to a buffer.
Modified:
llvm/trunk/tools/llvm-ar/llvm-ar.cpp
Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=211221&r1=211220&r2=211221&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Wed Jun 18 16:08:17 2014
@@ -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;
More information about the llvm-commits
mailing list