Ensure we have atleast 2-byte alignment for member functions.
llvm-svn: 83337
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index f7fe69e..b9013a8 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -348,6 +348,9 @@
if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
F->setAlignment(AA->getAlignment()/8);
+ // C++ ABI requires 2-byte alignment for member functions.
+ if (F->getAlignment() < 16 && isa<CXXMethodDecl>(D))
+ F->setAlignment(16/8);
}
void CodeGenModule::SetCommonAttributes(const Decl *D,