[PATCH] Proper whole-archive handling

Rui Ueyama ruiu at google.com
Tue Sep 3 14:58:08 PDT 2013



================
Comment at: include/lld/Core/LinkingContext.h:271
@@ -278,3 +270,3 @@
   virtual error_code
-  parseFile(std::unique_ptr<MemoryBuffer> &inputBuff,
+  parseFile(LinkerInput &input, std::unique_ptr<MemoryBuffer> &inputBuff,
             std::vector<std::unique_ptr<File> > &result) const = 0;
----------------
Rui Ueyama wrote:
> Can you move inputBuff into input, so that we don't need to pass both LinkerInput and MemoryBuffer, both representing an input file, to all the member functions? Looks like LinkerInput already has a field for a memory buffer for a file, so we may be able to use the field.
Looking into this more closely, and noticed that LinkingContext::readFile() and LinkerInput::getBuffer() have duplicate code. LinkerInput is designed to lazy-load a file when getBuffer is called, but LinkerInput does not for some reason use the method and read a file into a MemoryBuffer by itself. I think we should fix LinkingContext::readFile() to use LinkerInput::getBuffer(). If readFile() becomes an empty function as a result we should remove the function.


http://llvm-reviews.chandlerc.com/D1587



More information about the llvm-commits mailing list