[lld] r265512 - Do not allocate MipsReginfo using BumpPtrAllocator.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 07:44:49 PDT 2016


This was showing as a leak in the asan bot?

Cheers,
Rafael


On 5 April 2016 at 22:52, Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> 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;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list