[llvm-commits] [llvm] r63834 - /llvm/trunk/tools/gold/gold-plugin.cpp

Nick Lewycky nicholas at mxc.ca
Wed Feb 4 21:36:02 PST 2009


Author: nicholas
Date: Wed Feb  4 23:36:01 2009
New Revision: 63834

URL: http://llvm.org/viewvc/llvm-project?rev=63834&view=rev
Log:
It's not obvious, but lto_module_create_from_memory doesn't need to use the
buffer after it creates the Module. Thus, we don't need to store this pointer
in claimed_file.

Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=63834&r1=63833&r2=63834&view=diff

==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Feb  4 23:36:01 2009
@@ -45,7 +45,6 @@
   struct claimed_file {
     lto_module_t M;
     void *handle;
-    void *buf;
     std::vector<ld_plugin_symbol> syms;
   };
 
@@ -197,7 +196,6 @@
 
   cf.M = buf ? lto_module_create_from_memory(buf, file->filesize) :
                lto_module_create(file->name);
-  cf.buf = buf;
   if (!cf.M) {
     (*message)(LDPL_ERROR, "Failed to create LLVM module: %s",
                lto_get_error_message());
@@ -334,10 +332,6 @@
   objFile->close();
 
   lto_codegen_dispose(cg);
-  for (std::list<claimed_file>::iterator I = Modules.begin(),
-       E = Modules.end(); I != E; ++I) {
-    free(I->buf);
-  }
 
   if ((*add_input_file)(const_cast<char*>(uniqueObjPath.c_str())) != LDPS_OK) {
     (*message)(LDPL_ERROR, "Unable to add .o file to the link.");





More information about the llvm-commits mailing list