aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2022-12-01 12:34:21 +0000
committerGuillaume Chatelet <gchatelet@google.com>2022-12-09 09:34:43 +0000
commit10c47465e2505ddfee4e62a2ab2e535abea3ec56 (patch)
tree38d9b76aad1ecf72737610cf69209b7d2818f55e /llvm/lib/Object/MachOObjectFile.cpp
parent9556b678408bdbd53083938346dbb7b0467176ac (diff)
downloadllvm-10c47465e2505ddfee4e62a2ab2e535abea3ec56.zip
llvm-10c47465e2505ddfee4e62a2ab2e535abea3ec56.tar.gz
llvm-10c47465e2505ddfee4e62a2ab2e535abea3ec56.tar.bz2
[Alignment] Use Align for ObjectFile::getSectionAlignment
Differential Revision: https://reviews.llvm.org/D139098
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 39e84ff..7f90284 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -1990,17 +1990,10 @@ MachOObjectFile::getSectionContents(DataRefImpl Sec) const {
return getSectionContents(Offset, Size);
}
-uint64_t MachOObjectFile::getSectionAlignment(DataRefImpl Sec) const {
- uint32_t Align;
- if (is64Bit()) {
- MachO::section_64 Sect = getSection64(Sec);
- Align = Sect.align;
- } else {
- MachO::section Sect = getSection(Sec);
- Align = Sect.align;
- }
+Align MachOObjectFile::getSectionAlignment(DataRefImpl Sec) const {
- return uint64_t(1) << Align;
+ return is64Bit() ? Align(1ULL << getSection64(Sec).align)
+ : Align(1ULL << getSection(Sec).align);
}
Expected<SectionRef> MachOObjectFile::getSection(unsigned SectionIndex) const {