[PATCH] [ELF] Simplify adding default atoms
Simon Atanasyan
simon at atanasyan.com
Mon Apr 6 22:50:16 PDT 2015
Hi shankar.easwaran, ruiu,
Now 'writer' creates an instance of `RuntimeFile` in the constructor, then populates the file in the virtual function `addDefaultAtoms`, then pass owning of this file to the caller of virtual function `createImplicitFiles`.
First, we do not need to keep an instance of `RuntimeFile` so long. It is enough to create the file, right after that populate it and pass the owning.
Second, relationship between `createImplicitFiles` and `addDefaultAtoms` is complicated. The `createImplicitFiles` might call `addDefaultAtoms`, overridden version of `addDefaultAtoms` might call base class `addDefaultAtoms`, and overridden version of `createImplicitFiles` might call base class `createImplicitFiles` as well as `addDefaultAtoms`.
The patch solves both problems above. It creates and populates runtime files right in the createImplicitFiles(), removes `addDefaultAtoms` at all and does not keep references to runtime files in class fields.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D8852
Files:
lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h
lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.h
lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h
lib/ReaderWriter/ELF/DynamicLibraryWriter.h
lib/ReaderWriter/ELF/ExecutableWriter.h
lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h
lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h
lib/ReaderWriter/ELF/OutputELFWriter.h
lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h
lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h
lib/ReaderWriter/ELF/X86_64/X86_64DynamicLibraryWriter.h
lib/ReaderWriter/ELF/X86_64/X86_64ExecutableWriter.h
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8852.23309.patch
Type: text/x-patch
Size: 14209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150407/bbcbf5f0/attachment.bin>
More information about the llvm-commits
mailing list