[lld] r265512 - Do not allocate MipsReginfo using BumpPtrAllocator.
    Rui Ueyama via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Apr  5 19:52:48 PDT 2016
    
    
  
Author: ruiu
Date: Tue Apr  5 21:52:47 2016
New Revision: 265512
URL: http://llvm.org/viewvc/llvm-project?rev=265512&view=rev
Log:
Do not allocate MipsReginfo using BumpPtrAllocator.
So that MipsReginfo's destructor will be called.
Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/ELF/InputFiles.h
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=265512&r1=265511&r2=265512&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Apr  5 21:52:47 2016
@@ -268,8 +268,8 @@ elf::ObjectFile<ELFT>::createInputSectio
   // A MIPS object file has a special section that contains register
   // usage info, which needs to be handled by the linker specially.
   if (Config->EMachine == EM_MIPS && Name == ".reginfo") {
-    MipsReginfo = new (Alloc) MipsReginfoInputSection<ELFT>(this, &Sec);
-    return MipsReginfo;
+    MipsReginfo.reset(new MipsReginfoInputSection<ELFT>(this, &Sec));
+    return MipsReginfo.get();
   }
 
   // We dont need special handling of .eh_frame sections if relocatable
Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=265512&r1=265511&r2=265512&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Tue Apr  5 21:52:47 2016
@@ -146,7 +146,7 @@ private:
   std::vector<SymbolBody *> SymbolBodies;
 
   // MIPS .reginfo section defined by this file.
-  MipsReginfoInputSection<ELFT> *MipsReginfo = nullptr;
+  std::unique_ptr<MipsReginfoInputSection<ELFT>> MipsReginfo;
 
   llvm::BumpPtrAllocator Alloc;
   llvm::SpecificBumpPtrAllocator<InputSection<ELFT>> IAlloc;
    
    
More information about the llvm-commits
mailing list