aboutsummaryrefslogtreecommitdiff
path: root/lib/Object
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2013-01-15 07:44:25 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2013-01-15 07:44:25 +0000
commitac97f5ce486d1ca2967607028eacddd860aaddd0 (patch)
tree4a08e2f3f6154b0b9ccf6487a63e9f6ef3e5f668 /lib/Object
parentb5f8cd5bb04df52c05cbd1eddf081e6d9cf9cd64 (diff)
[Object][ELF] Simplify ELFObjectFile by using ELFType.
This simplifies the usage and implementation of ELFObjectFile by using ELFType to replace: <endianness target_endianness, std::size_t max_alignment, bool is64Bits> This does complicate the base ELF types as they must now use template template parameters to partially specialize for the 32 and 64bit cases. However these are only defined once. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r--lib/Object/ELFObjectFile.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/Object/ELFObjectFile.cpp b/lib/Object/ELFObjectFile.cpp
index 2c8c1b16d1..160053dabd 100644
--- a/lib/Object/ELFObjectFile.cpp
+++ b/lib/Object/ELFObjectFile.cpp
@@ -28,30 +28,30 @@ ObjectFile *ObjectFile::createELFObjectFile(MemoryBuffer *Object) {
if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2LSB)
if (MaxAlignment >= 4)
- return new ELFObjectFile<support::little, 4, false>(Object, ec);
+ return new ELFObjectFile<ELFType<support::little, 4, false> >(Object, ec);
else if (MaxAlignment >= 2)
- return new ELFObjectFile<support::little, 2, false>(Object, ec);
+ return new ELFObjectFile<ELFType<support::little, 2, false> >(Object, ec);
else
llvm_unreachable("Invalid alignment for ELF file!");
else if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2MSB)
if (MaxAlignment >= 4)
- return new ELFObjectFile<support::big, 4, false>(Object, ec);
+ return new ELFObjectFile<ELFType<support::big, 4, false> >(Object, ec);
else if (MaxAlignment >= 2)
- return new ELFObjectFile<support::big, 2, false>(Object, ec);
+ return new ELFObjectFile<ELFType<support::big, 2, false> >(Object, ec);
else
llvm_unreachable("Invalid alignment for ELF file!");
else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2MSB)
if (MaxAlignment >= 8)
- return new ELFObjectFile<support::big, 8, true>(Object, ec);
+ return new ELFObjectFile<ELFType<support::big, 8, true> >(Object, ec);
else if (MaxAlignment >= 2)
- return new ELFObjectFile<support::big, 2, true>(Object, ec);
+ return new ELFObjectFile<ELFType<support::big, 2, true> >(Object, ec);
else
llvm_unreachable("Invalid alignment for ELF file!");
else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2LSB) {
if (MaxAlignment >= 8)
- return new ELFObjectFile<support::little, 8, true>(Object, ec);
+ return new ELFObjectFile<ELFType<support::little, 8, true> >(Object, ec);
else if (MaxAlignment >= 2)
- return new ELFObjectFile<support::little, 2, true>(Object, ec);
+ return new ELFObjectFile<ELFType<support::little, 2, true> >(Object, ec);
else
llvm_unreachable("Invalid alignment for ELF file!");
}