[PATCH] D51759: [llvm] Improve the performance of getSymbols used by ArchiveWriter

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 6 17:02:05 PDT 2018


abdulras accepted this revision.
abdulras added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Object/ArchiveWriter.cpp:376
 
-  Expected<std::unique_ptr<object::SymbolicFile>> ObjOrErr =
-      object::SymbolicFile::createSymbolicFile(Buf, llvm::file_magic::unknown,
-                                               &Context);
-  if (!ObjOrErr) {
-    // FIXME: check only for "not an object file" errors.
-    consumeError(ObjOrErr.takeError());
-    return Ret;
+  LLVMContext Context;
+  std::unique_ptr<object::SymbolicFile> Obj;
----------------
Can't this be sunk into the condition on L378?  That will avoid the unnecessary construction.


Repository:
  rL LLVM

https://reviews.llvm.org/D51759





More information about the llvm-commits mailing list