diff options
author | David Srbecky <dsrbecky@google.com> | 2015-04-22 12:20:22 +0100 |
---|---|---|
committer | David Srbecky <dsrbecky@google.com> | 2015-04-22 16:56:23 +0100 |
commit | 533c207f9d2da6d913c4b10f6f757fe9d6367b10 (patch) | |
tree | 1e2c1bf5c91898e785398a3d66e7e7570e8b29db /compiler/dwarf | |
parent | 8d1ba74fe48703fc2b5a5920dd5eea0c65db5b15 (diff) | |
download | art-533c207f9d2da6d913c4b10f6f757fe9d6367b10.zip art-533c207f9d2da6d913c4b10f6f757fe9d6367b10.tar.gz art-533c207f9d2da6d913c4b10f6f757fe9d6367b10.tar.bz2 |
Simplify template parameters of Elf classes.
The ELF specification defines several types which differ between
32-bit ELF and 64-bit ELF. We used to template all ELF-related
methods on all of those types which was very verbose.
This CL wraps all the types as typedefs in ElfTypes32 and ElfTypes64.
One of those wrappers is then used as the template parameter.
Change-Id: I65247c2c79d92a7c4799e988cf3e4a1b10eb4788
Diffstat (limited to 'compiler/dwarf')
-rw-r--r-- | compiler/dwarf/dwarf_test.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/dwarf/dwarf_test.h b/compiler/dwarf/dwarf_test.h index d31cfa5..99b8e79 100644 --- a/compiler/dwarf/dwarf_test.h +++ b/compiler/dwarf/dwarf_test.h @@ -56,8 +56,7 @@ class DwarfTest : public CommonRuntimeTest { } // Pretty-print the generated DWARF data using objdump. - template<typename Elf_Word, typename Elf_Sword, typename Elf_Addr, typename Elf_Dyn, - typename Elf_Sym, typename Elf_Ehdr, typename Elf_Phdr, typename Elf_Shdr> + template<typename ElfTypes> std::vector<std::string> Objdump(bool is64bit, const char* args) { // Write simple elf file with just the DWARF sections. class NoCode : public CodeOutput { @@ -66,10 +65,9 @@ class DwarfTest : public CommonRuntimeTest { } code; ScratchFile file; InstructionSet isa = is64bit ? kX86_64 : kX86; - ElfBuilder<Elf_Word, Elf_Sword, Elf_Addr, Elf_Dyn, - Elf_Sym, Elf_Ehdr, Elf_Phdr, Elf_Shdr> builder( + ElfBuilder<ElfTypes> builder( &code, file.GetFile(), isa, 0, 0, 0, 0, 0, 0, false, false); - typedef ElfRawSectionBuilder<Elf_Word, Elf_Sword, Elf_Shdr> Section; + typedef ElfRawSectionBuilder<ElfTypes> Section; Section debug_info(".debug_info", SHT_PROGBITS, 0, nullptr, 0, 1, 0); Section debug_abbrev(".debug_abbrev", SHT_PROGBITS, 0, nullptr, 0, 1, 0); Section debug_str(".debug_str", SHT_PROGBITS, 0, nullptr, 0, 1, 0); @@ -125,11 +123,9 @@ class DwarfTest : public CommonRuntimeTest { std::vector<std::string> Objdump(bool is64bit, const char* args) { if (is64bit) { - return Objdump<Elf64_Word, Elf64_Sword, Elf64_Addr, Elf64_Dyn, - Elf64_Sym, Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr>(is64bit, args); + return Objdump<ElfTypes64>(is64bit, args); } else { - return Objdump<Elf32_Word, Elf32_Sword, Elf32_Addr, Elf32_Dyn, - Elf32_Sym, Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr>(is64bit, args); + return Objdump<ElfTypes32>(is64bit, args); } } |