summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/MicrosoftCXXABI.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-04-24 01:24:59 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-04-24 01:24:59 +0000
commit37ea57862f385c48d2c52e63e74bc238409e402a (patch)
tree01268eafe83895411fbefbb33c33e40b65022b2d /clang/lib/AST/MicrosoftCXXABI.cpp
parentf417ff95bcef5322eac52ee71a446c7c60012830 (diff)
downloadbcm5719-llvm-37ea57862f385c48d2c52e63e74bc238409e402a.tar.gz
bcm5719-llvm-37ea57862f385c48d2c52e63e74bc238409e402a.zip
Cleanup some MS-ABI specific code
No functional change intended. llvm-svn: 235680
Diffstat (limited to 'clang/lib/AST/MicrosoftCXXABI.cpp')
-rw-r--r--clang/lib/AST/MicrosoftCXXABI.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/lib/AST/MicrosoftCXXABI.cpp b/clang/lib/AST/MicrosoftCXXABI.cpp
index fb3beff4beb..4eb960a60dc 100644
--- a/clang/lib/AST/MicrosoftCXXABI.cpp
+++ b/clang/lib/AST/MicrosoftCXXABI.cpp
@@ -213,29 +213,28 @@ getMSMemberPointerSlots(const MemberPointerType *MPT) {
std::pair<uint64_t, unsigned> MicrosoftCXXABI::getMemberPointerWidthAndAlign(
const MemberPointerType *MPT) const {
- const TargetInfo &Target = Context.getTargetInfo();
- assert(Target.getTriple().getArch() == llvm::Triple::x86 ||
- Target.getTriple().getArch() == llvm::Triple::x86_64);
- unsigned Ptrs, Ints;
- std::tie(Ptrs, Ints) = getMSMemberPointerSlots(MPT);
// The nominal struct is laid out with pointers followed by ints and aligned
// to a pointer width if any are present and an int width otherwise.
+ const TargetInfo &Target = Context.getTargetInfo();
unsigned PtrSize = Target.getPointerWidth(0);
unsigned IntSize = Target.getIntWidth();
+
+ unsigned Ptrs, Ints;
+ std::tie(Ptrs, Ints) = getMSMemberPointerSlots(MPT);
uint64_t Width = Ptrs * PtrSize + Ints * IntSize;
unsigned Align;
// When MSVC does x86_32 record layout, it aligns aggregate member pointers to
// 8 bytes. However, __alignof usually returns 4 for data memptrs and 8 for
// function memptrs.
- if (Ptrs + Ints > 1 && Target.getTriple().getArch() == llvm::Triple::x86)
- Align = 8 * 8;
+ if (Ptrs + Ints > 1 && Target.getTriple().isArch32Bit())
+ Align = 64;
else if (Ptrs)
Align = Target.getPointerAlign(0);
else
Align = Target.getIntAlign();
- if (Target.getTriple().getArch() == llvm::Triple::x86_64)
+ if (Target.getTriple().isArch64Bit())
Width = llvm::RoundUpToAlignment(Width, Align);
return std::make_pair(Width, Align);
}
OpenPOWER on IntegriCloud