[PATCH] Atoms generated by a pass should be owned by the generated file and not the pass itself.

Jean-Daniel Dupas mailing at xenonium.com
Thu Dec 18 04:45:27 PST 2014


Hi kledzik,

Some Mach-O specific passes own a MachOFile member that is used to allocate the generated atoms. This is a fragile pattern as the generated atoms and references lifespan are tied to the pass lifespan and freed when the pass instance is destroyed.

While it is not an issue today as the PassManager is not destroy before we write the linked file, there is no guarantee it will always work.

Now that the File base class provide an allocator, we can use the processed file's allocator to generate new atoms. 


Note: I have commit rights, so if that patch is good, I'll be glad to commit it myself ;-)

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6719

Files:
  lib/ReaderWriter/MachO/ArchHandler.h
  lib/ReaderWriter/MachO/ArchHandler_arm.cpp
  lib/ReaderWriter/MachO/CompactUnwindPass.cpp
  lib/ReaderWriter/MachO/GOTPass.cpp
  lib/ReaderWriter/MachO/ShimPass.cpp
  lib/ReaderWriter/MachO/StubsPass.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6719.17428.patch
Type: text/x-patch
Size: 10835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141218/fba046b4/attachment.bin>


More information about the llvm-commits mailing list